This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Wide-character literals and arbitrary unicode characters?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]