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 adva

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, I'd like to understand how much better this "ptrdiff_t world" is. > This has the advantage that signed integer overflow can be detected > automatically on some platforms You mean "-fsanitize=undefined", right? Does this also catch the following situations? a) Pointer subtraction. I

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 o

preferring ptrdiff_t to size_t for object counts

2017-06-04 Thread Paul Eggert
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 would like to change the Gnulib modules that GNU Emac