This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add <stdint.h> integer width macros


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]