|
From: Per W. <pw...@ia...> - 2003-03-05 11:30:29
|
No, multicharacter literals they are not specifically indented for
wchar_t.
They are defined to be of type int, and if you want store multiple char
characters, you write:
int i =3D 'abcd'
and for wchar_t
int i =3D L'ab'
where a 32-bit integer only have room for two wide characters.
The problematic non-standard issue with multicharacter literals is that
you are not guaranteed to know byte order of the machine, and the order
the multiple characters are stored in the integer, so you have to do some
condintional compilation if you want to save/load them.
You might have to do something like
#if '1234' =3D=3D 0x31323334L
// init alternative 1
#elseif '1234' =3D=3D 0x34333231L
// init alternative 2
#else
// no known byte order
#endif
Even if you use bitset, you still have to check which character goes into
the high bits, and which character goes to the low bits of the integer.
/Per W
PS - thx for the pdf reference, I haven't had access to a
computer-readable edition before :-)
On Wed, 5 Mar 2003, Ioannis Vranos wrote:
> -------Original Message-------
>
> From: Per Westermark
> Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 10:03:30 =F0=EC
> To: Ioannis Vranos
> Cc: Dev-C++ Mailing List
> Subject: Re: [Dev-C++] Character variables
>
> One more thing. I haven't a standard available right now, and a prelimina=
r
> google only picked up an old -97 preliminary C++ standard.
>
> There you have your multicharacter literals in chapter 2 lexical
> conventions.
>
>
> =3D=3D> Yes but they are intended for wchar_t.
>
>
> http://anubis.dkuug.dk/jtc1/sc22/open/n2356/
>
>
> =3D=3D> Squeezing google for maximum efficiency reveals many sites. :) On=
e of
> them is this:
>
> http://www.rgai.hu/~beszedes/munka/
>
>
> However i do not know if downloading the pdf is legal. Damn, life is full=
of
> temptations...
>
>
>
> Ioannis Vranos
>
> * Programming pages: http://www.noicys.freeurl.com
> * Alternative URL: http://run.to/noicys
|