Don't discuss details of what type size_t might be typedefed to
Paul Eggert
eggert@cs.ucla.edu
Mon Feb 27 02:43:00 GMT 2012
On 02/26/2012 05:05 PM, Joseph S. Myers wrote:
> I think it's best just to
> describe size_t abstractly without detailing particular types it might
> be equivalent to.
Some fixes are needed in this area, but I think this goes too far.
First, although the C standard allows size_t to be
'unsigned short' or even 'unsigned char', glibc doesn't
now and is unlikely ever port to any such host. It'd be a pain for
application writers to worry about such (theoretical) platforms,
so it's helpful for the manual to say that size_t is no narrower
than 'unsigned int'.
Second, the C standard recommends that size_t shouldn't have
an integer conversion rank greater than 'long' unless it's necessary.
For application writers' benefit, the glibc manual should document
the platforms where it's really necessary for size_t to be wider than
'unsigned long'. Currently this is the empty set for glibc, and the
manual should document that.
More information about the Libc-alpha
mailing list