Different __WCHAR_TYPE__/wchar_t for gcc -m32 on Linux/i386 and Linux/x86-64
Joseph S. Myers
joseph@codesourcery.com
Wed May 30 16:50:00 GMT 2012
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
More information about the Libc-alpha
mailing list