wide character issues with gcc 3.2

Anthony Feick afeick@hotmail.com
Tue Aug 20 13:00:00 GMT 2002


Previously I sent this to "gcc@gcc.gnu.org", but it seems to be an issue 
with basic_string, so this may be a more apporpriate list. (And Benjamin 
Kosnik suggested it.)


Gcc 3.2 on linux compiles and links our app, but -fshort-wchar doesn't seem 
to be working completely.  The compiler directive 'L' converts character 
strings properly, and wchar_t is the right size.  The problem is that 
"basic_string<wchar_t>" still thinks everything is 4-bytes.

basic_string<wchar_t> foo = L"foo";
foo[0] is 'f'
foo[1] is 'o'
foo[2] is uninitialized

also

basic_string<wchar_t> bar;
bar.push_back((wchar_t)'b');
bar.push_back((wchar_t)'a');
bar.push_back((wchar_t)'r');
bar.c_str[0] is 'b'
bar.c_str[1] is 0
bar.c_str[2] is 'a'
bar.c_str[3] is 0
bar.c_str[4] is 'r'
bar.c_str[5] is 0

$ gcc -v
Reading specs from 
/home/shared/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: ../gcc-3.2/configure --prefix=/home/shared/local 
--enable-shared --enable-threads=posix --enable-__cxa_atexit
Thread model: posix
gcc version 3.2




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com



More information about the Libstdc++ mailing list