[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: preferring ptrdiff_t to size_t for object counts

From: Bruno Haible
Subject: Re: preferring ptrdiff_t to size_t for object counts
Date: Thu, 08 Jun 2017 02:36:10 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-79-generic; KDE/5.18.0; x86_64; ; )

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 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.

Indeed. (Although portability to Windows 3.1 is not in the focus of gnulib
nor of GNU programs any more.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]