|
From: Ioannis V. <no...@ho...> - 2003-03-05 12:14:47
|
-------Original Message-------=0D
=0D
From: Per Westermark=0D
Date: =D4=E5=F4=DC=F1=F4=E7, 5 =CC=DC=F1=F4=E9=EF=F2 2003 1:29:06 =EC=EC=0D
To: Ioannis Vranos=0D
Cc: Dev-C++ Mailing List=0D
Subject: Re: [Dev-C++] Character variables=0D
=0D
No, multicharacter literals they are not specifically indented for=0D
wchar_t.=0D
=0D
They are defined to be of type int, and if you want store multiple char=0D
characters, you write:=0D
int i =3D 'abcd'=0D
and for wchar_t=0D
int i =3D L'ab'=0D
where a 32-bit integer only have room for two wide characters.=0D
=0D
=0D
=3D=3D> Yes but their meaning is implementation defined. I do not know mu=
ch for
them, and have only met them in one paragraph in TC++PL up to now that i =
am
on chapter 19.=0D
=0D
=0D
=0D
=0D
The problematic non-standard issue with multicharacter literals is that=0D
you are not guaranteed to know byte order of the machine, and the order=0D
the multiple characters are stored in the integer, so you have to do some=
=0D
condintional compilation if you want to save/load them.=0D
=0D
You might have to do something like=0D
#if '1234' =3D=3D 0x31323334L=0D
// init alternative 1=0D
#elseif '1234' =3D=3D 0x34333231L=0D
// init alternative 2=0D
#else=0D
// no known byte order=0D
#endif=0D
=0D
Even if you use bitset, you still have to check which character goes into=
=0D
the high bits, and which character goes to the low bits of the integer.=0D
=0D
=0D
=3D=3D> Personally i can't find any use of them, if you want to add them =
in
specific order in a bitset you can do:=0D
=0D
=0D
bitset<numeric_limits<char>::digits10 *2>tag('a');=0D
=0D
tag<<=3Dnumeric_limits<char>::digits10;=0D
=0D
tag&=3Dbitset<numeric_limits<char>::digits10 *2>('b');=0D
=0D
=0D
(i made a mistake in a previous email where i combined 2 different bitset
types (bitset<32> with bitset<4>).=0D
=0D
=0D
PS - thx for the pdf reference, I haven't had access to a=0D
computer-readable edition before :-)=0D
=0D
=0D
=3D=3D> Yes, all standards now come in .pdf form. It's the same .pdf as s=
old
from ISO web site.=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys=20 |