This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Different __WCHAR_TYPE__/wchar_t for gcc -m32 on Linux/i386 andLinux/x86-64
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 30 May 2012 16:25:11 +0000 (UTC)
- Subject: Re: Different __WCHAR_TYPE__/wchar_t for gcc -m32 on Linux/i386 andLinux/x86-64
- References: <CAMe9rOoWnBS8DqVWSndJ2TJGVV=k2j8n5WOF4_zjFYDFqdZJ3A@mail.gmail.com>
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