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: Different __WCHAR_TYPE__/wchar_t for gcc -m32 on Linux/i386 andLinux/x86-64


On Wed, 30 May 2012, H.J. Lu wrote:

> On Linux/i386:

> long int

> On Linux/x86-64:
> 
> [hjl@gnu-6 include]$ echo __WCHAR_TYPE__ | gcc -m32 -E -

> int

That's a bug.  Not a very serious one - it doesn't affect C++ name 
mangling because wchar_t is a built-in type in C++, with its own mangling 
- but still a bug.  The choice of underlying type for wchar_t should not 
depend on what the compiler defaults to like that.  (Actually, it looks 
like a 32-bit-default compiler built --enable-targets=all also uses "int" 
here.)

The types of WCHAR_MIN and WCHAR_MAX in both stdint.h and wchar.h need to 
correspond correctly to the underlying type of wchar_t.  GCC's stdint.h 
gets this right automatically, glibc has bits/wchar.h with a special 
sysdeps/unix/sysv/linux/i386 version to use "long".

-- 
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]