[PATCH 64bit] ssize_t

Eric Blake eblake@redhat.com
Wed Feb 20 21:29:00 GMT 2013


On 02/20/2013 01:49 PM, Joseph S. Myers wrote:
> On Wed, 20 Feb 2013, Eric Blake wrote:
> 
>> If only gcc had given us __SSIZE_TYPE__ to begin with.  We could
>> generate __SIZE_TYPE__ from __SSIZE_TYPE__ (slap on an unsigned); but
>> once the unsigned is there, there is no way in C preprocessor to pull it
>> back out.
> 
> #define unsigned signed before the typedef, #undef unsigned after it, 
> exactly as done in GCC's format-checking testsuite to get the signed type 
> corresponding to size_t.

Interesting idea!  So basically you are suggesting the very-maintainable:

#ifdef __SIZE_TYPE__
#define unsigned signed
typedef ssize_t __SIZE_TYPE__;
#undefine unsigned
#else
  // not gcc, good luck getting a sane default
#endif

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20130220/5f57dd61/attachment.sig>


More information about the Newlib mailing list