Re: preferring ptrdiff_t to size_t

2019-01-05 Thread Bruno Haible
Paul Eggert wrote: > Using signed types is better nowadays than using unsigned types, since > many platforms now check for signed integer overflow and this can catch many > bugs, some of them security-relevant, whereas unsigned arithmetic is well > defined to wrap around with no overflow check

Re: preferring ptrdiff_t to size_t for object counts

2017-06-07 Thread Bruno Haible
Hi Paul, > 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). Fine with me. It doesn't collide: Only very few packages use this identifier 'in_t', and only in isolated places. > One other

Re: preferring ptrdiff_t to size_t for object counts

2017-06-07 Thread Paul Eggert
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

Re: preferring ptrdiff_t to size_t for object counts

2017-06-07 Thread Bruno Haible
I wrote: > typedef ptrdiff_t wsize_t; 'wsize_t' or 'wcount_t'. I don't really mind the name of the type - as long as it's a typedef. Bruno

Re: preferring ptrdiff_t to size_t for object counts

2017-06-05 Thread Bruno Haible
Hi Paul, > GNU Emacs has long been using signed types (typically ptrdiff_t) to count > objects. This has the advantage that signed integer overflow can be detected > automatically on some platforms (unfortunately, size_t arithmetic silently > wraps > around). I have one objection, but a big