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]

Wide-character literals and arbitrary unicode characters?


Hi,

Sorry for this maybe a silly question, but I have been unable to find a clear answer to it anywhere. The version of gcc I use now is egcs-2.91.66, and maybe I just need to upgrade?

Suppose I need to compile a string of wide characters like this:

wchar_t *wcstr=L"ABCDEFG";

After compilation, it gives:

.globl wcstr
.section .rodata
.align 32
.LC0:
.string "A"
.string ""
.string ""
.string "B"
.string ""
.string ""
.string "C"
.string ""
.string ""
.string "D"
.string ""
.string ""
.string "E"
.string ""
.string ""
.string "F"
.string ""
.string ""
.string "G"
.string ""
.string ""
.string ""
.string ""
.string ""
.string ""


i. e. every character is 4 bytes wide. This is OK. Now assume I want to insert some character (e.g. "CYRILLIC CAPITAL LETTER A", code=0x410) specifying its hexadecimal code, followed by the Latin letter A:


wchar_t *wcstr=L"\u0410A";

results in

.globl wcstr
.section .rodata
.align 4
.LC0:
.string "u"
.string ""
.string ""
.string "0"
.string ""
.string ""
.string "4"
.string ""
.string ""
.string "1"
.string ""
.string ""
.string "0"
.string ""
.string ""
.string "A"
.string ""
.string ""
.string ""
.string ""
.string ""
.string ""

i. e. \u (Java syntax) is not recognized by GCC.


wchar_t *wcstr=L"\x0410A";

results in

.globl wcstr
.section .rodata
.align 4
.LC0:
.string "\n"
.string ""
.string ""
.string ""
.string ""
.string ""
.string ""

and so does L"\x00000410A" (assuming that characters are 32-bit); that's weird.

\xu0410 complains that non-hex digit is in a hex constant. \ux - no error, and no luck. Google search gives nothing but permanent discueeions and no clear information.

And so on, without any luck. FAQ at gcc.cnu.org does not say a word on the subject.

So what can I do?

Thenks in advance for any help.

--
Dmitry M. Golubovsky
South Lyon, MI



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