This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Don't discuss details of what type size_t might be typedefedto
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Sun, 26 Feb 2012 18:42:52 -0800
- Subject: Re: Don't discuss details of what type size_t might be typedefedto
- References: <Pine.LNX.4.64.1202270058300.30479@digraph.polyomino.org.uk>
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.