Add <stdint.h> integer width macros

Joseph Myers joseph@codesourcery.com
Tue Sep 20 20:52:00 GMT 2016


On Tue, 20 Sep 2016, Paul Eggert wrote:

> On 09/20/2016 01:21 PM, Joseph Myers wrote:
> > +# define WCHAR_WIDTH 32
> 
> When compiling with 'gcc -fshort-wchar' this should be 16, to be consistent
> with WCHAR_MAX.

Compiling with -fshort-wchar is not compatible with using glibc; it's an 
ABI-breaking option.  (On ARM you'll get a link error if you try because 
of the EABI object attributes.)

The special handling of WCHAR_MIN and WCHAR_MAX is because (a) they go in 
wchar.h as well as in stdint.h (they first appeared in C90 Amendment 1, 
which didn't have stdint.h) and (b) the underlying type may vary between 
architectures in a way that doesn't just depend on word size, which 
complicates things if using a compiler without the relevant predefines.  
It's not about -fshort-wchar, and the fallback definitions in bits/wchar.h 
for compilers without such predefines make no atttempt to handle 
-fshort-wchar.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list