|
From: | Paul Eggert |
Subject: | Re: preferring ptrdiff_t to size_t for object counts |
Date: | Wed, 7 Jun 2017 15:12:04 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
On 06/07/2017 02:53 PM, Bruno Haible wrote:
I don't really mind the name of the type - as long as it's a typedef.
I've been leaning towards a name that doesn't start with 'w', since the type is not specific to the walloc module family. The name I'm currently thinking of is 'in_t', short for "index type". That's an easy-to-remember name (the type is like 'int', but possibly wider).
One other advantage of having our own signed type is that we can guarantee that it's at least as wide as int (something that is not true for ptrdiff_t). That way, some of my current code that says 'MIN (INT_MAX, PTRDIFF_MAX)' can be simplified to the more-natural INT_MAX. This is helpful for traditional interfaces that use int counters.
[Prev in Thread] | Current Thread | [Next in Thread] |