From: Bo Persson on 21 Jan 2010 09:16 Martin B. wrote: > Le Chaud Lapin wrote: >> On Jan 19, 12:45 am, Jerry Coffin <jerryvcof...(a)yahoo.com> wrote: >>> In article <20b7032a-896f-4702-b9b8-62d164ec5474 >>> @h9g2000yqa.googlegroups.com>, jaibudu...(a)gmail.com says... >>>> { The question concerns the two C++0x types char16_t and >>>> char32_t. -mod } Hi All, >>>> Any idea when these two types [char16_t and char32_t] will be >>>> commonly supported across major compilers? >>> They are currently supported in gcc and the beta version of >>> VS/VC++ 2010. I'd expect that most compilers that don't support >>> them already will probably add that support quite quickly. >> >> Thanks Jerry. >> ... >> else, the obvious choice being wchar_t, and it appears that >> Microsoft, right now, is simply making it an alias: >> ... >> typedef unsigned short char16_t; >> typedef unsigned int char32_t; >> ... >> >> ... I arrived at the conclusion that it was not as trivial as it >> might seem for the compiler developer. >> >> Unfortunately, I cannot recall they exact thought process that >> lead me to this conclusion. I think it had to do with hard choices >> regarding policy. But it does not suprise me that Microsoft has >> deferred, at least for the time being, on making these bonafide >> distinct types. > > But the standard mandates these being distinct types? > So it's the whole "treat xyzchar_t as builtin type: Yes/No" mess all > over again? *Sigh* :-) > No. The library has support for the new char types, but the compiler does not. What can you do, except add a couple of (temporary) typedefs? Bo Persson -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Rune Allnor on 21 Jan 2010 13:57 On 8 Jan, 14:40, Le Chaud Lapin <jaibudu...(a)gmail.com> wrote: > On Jan 8, 12:48 am, Mathias Gaunard <loufo...(a)gmail.com> wrote: > > > On Jan 5, 2:35 am, Le Chaud Lapin <jaibudu...(a)gmail.com> wrote: > > > > { The question concerns the two C++0x types char16_t and char32_t. -mod } > > > > Hi All, > > > > Any idea when these two types will be commonly supported across major > > > compilers? > > > The types themselves are of little use. > > What you want are Unicode character and string literals. I know GCC > > supports them since version 4.5, no idea about MSVC. > > Then what are they for, and why have they been included in C++0x? You need types with explicitly defined sizes to access binary files. Rune -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Jerry Coffin on 22 Jan 2010 08:49 In article <b9f8fcbb-2abb-4642-a191-5dc940e6f941 @m25g2000yqc.googlegroups.com>, jaibuduvin(a)gmail.com says... [ ... ] > I just had one of my engineers check to see if VS2010 beta actually > supports char16_t versus simply making it an aliases for something > else, the obvious choice being wchar_t, and it appears that Microsoft, > right now, is simply making it an alias: Yup -- this is what I get for trusting their blog. Doing an actual test confirms that char16_t is simply an alias for unsigned short. One thing that really would be nice is the "strong typedef", that's been proposed (and even accepted, if memory serves) which would produce a new type just like an existing one, but still distinguishable for purposes like function overloading. -- Later, Jerry. [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Le Chaud Lapin on 25 Jan 2010 17:11 On Jan 22, 12:57 am, Rune Allnor <all...(a)tele.ntnu.no> wrote: > On 8 Jan, 14:40, Le Chaud Lapin <jaibudu...(a)gmail.com> wrote: > > > > Any idea when these two types will be commonly supported across major > > > > compilers? > > > > The types themselves are of little use. > > > What you want are Unicode character and string literals. I know GCC > > > supports them since version 4.5, no idea about MSVC. > > > Then what are they for, and why have they been included in C++0x? > > You need types with explicitly defined sizes to access > binary files. As I can no longer wait for char16_t and char32_t, I guess I will commit to wchar_t being the fundamental character type of my String class. How often does it occur that wchar_t < 16 bits? -Le Chaud Lapin- -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Daniel Krügler on 26 Jan 2010 05:14 On 26 Jan., 11:11, Le Chaud Lapin <jaibudu...(a)gmail.com> wrote: > On Jan 22, 12:57 am, Rune Allnor <all...(a)tele.ntnu.no> wrote: > > > On 8 Jan, 14:40, Le Chaud Lapin <jaibudu...(a)gmail.com> wrote: > > > > > Any idea when these two types will be commonly supported across major > > > > > compilers? > > > > > The types themselves are of little use. > > > > What you want are Unicode character and string literals. I know GCC > > > > supports them since version 4.5, no idea about MSVC. > > > > Then what are they for, and why have they been included in C++0x? > > > You need types with explicitly defined sizes to access > > binary files. > > As I can no longer wait for char16_t and char32_t, I guess I will > commit to wchar_t being the fundamental character type of my String > class. > > How often does it occur that wchar_t < 16 bits? I don't know of any compiler that does so. If you want to be sure you may test for the new C99 #define: __STDC_ISO_10646__ : An integer constant of the form yyyymmL (for example, 199712L). If this symbol is defined, then every character in the Unicode required set, when stored in an object of type wchar_t, has the same value as the short identifier of that character. The Unicode required set consists of all the characters that are defined by ISO/IEC 10646, along with all amendments and technical corrigenda, as of the specified year and month. If this is not available you may add a compile-time test that checks for std::numeric_limits<wchar_t>::digits, combined with it's sign information to check whether it's matches the bit constraints or just check WCHAR_MIN and WCHAR_MAX for the expected minimum ranges. HTH & Greetings from Bremen, Daniel Kr�gler -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: How to create a shallow copy without calling a constructor? Next: Generic compare function |