This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Wide-character literals and arbitrary unicode characters?
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Dimitry Golubovsky <dimitry at golubovsky dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 22 Sep 2002 14:46:32 -0700
- Subject: Re: Wide-character literals and arbitrary unicode characters?
- References: <3D8E1382.1060609@golubovsky.org>
On Sun, Sep 22, 2002 at 03:01:22PM -0400, Dimitry Golubovsky wrote:
>
> wchar_t *wcstr=L"\u0410A";
This notation was not implemented in egcs 1.1. In GCC 3.2 what you
get is
.string "\020\004"
.string ""
.string "A"
.string ""
[...]
which translates to 10 04 00 00 41 00 00 00 in the object file, which
is the correct little-endian UCS4 representation of the string you
wanted.
> wchar_t *wcstr=L"\x0410A";
This notation discards the leading zero, producing
.string "\nA"
.string ""
which is 0A 41 00 00 in the object file, aka U+410A (unassigned). You
could get the effect you wanted with \x by writing
wchar_t wcstr[] = L"\x0410" "A";
although this should not be counted on to produce CYRILLIC CAPITAL
LETTER A in all environments.
egcs 1.1 appears to be buggy here, but gcc 3.2 does the right thing.
zw