From: Peter C. Chapin on
James Kanze <james.kanze(a)gmail.com> wrote in news:fc2b2c43-3e94-4f6d-aaa4-
2b7c9d856ad2(a)d20g2000yqh.googlegroups.com:

> On Jan 8, 1:40 pm, Le Chaud Lapin <jaibudu...(a)gmail.com> wrote:
>
>> On Jan 8, 12:48 am, Mathias Gaunard <loufo...(a)gmail.com> wrote:
>>
>> Then what are they for, and why have they been included in C++0x?
>
> Because you can't implement UTF-16 and UTF-32 character and
> string literals without them.


Perhaps this is a FAQ, but I'm wondering what role wchar_t has in C++0x now
that we have types char16_t and char32_t. Is wchar_t now considered "legacy
support only" or is there some feature that it provides that is not
provided by the new types?

Peter

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Mathias Gaunard on
On 11 jan, 22:01, James Kanze <james.ka...(a)gmail.com> wrote:

> Because you can't implement UTF-16 and UTF-32 character and
> string literals without them. (Except that I disagree with
> regards to their utility. I find it rather a step forward to
> have a type which I know can hold a UTF-16 or a UTF-32 element.)

uint_least16_t and uint_least32_t work just as well for that.
Sure, it doesn't have the semantic attached to it, but that's not
needed to hold elements.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: SG on
On 16 Jan., 20:26, Mathias Gaunard <loufo...(a)gmail.com> wrote:
> On 11 jan, 22:01, James Kanze <james.ka...(a)gmail.com> wrote:
>
> > I find it rather a step forward to have a type
> > which I know can hold a UTF-16 or a UTF-32 element.)
>
> uint_least16_t and uint_least32_t work just as well for that.
> Sure, it doesn't have the semantic attached to it, but that's not
> needed to hold elements.

Though, there is a difference between uint_least16_t and char16_t. The
first is just an alias of some integer type while the second is a
distinct type. I'm not sure how important this is in reality but it
affects overloading, for example. Just wanted to mention this.

Cheers,
SG

--
[ 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
On Jan 18, 8:49 am, SG <s.gesem...(a)gmail.com> wrote:
> On 16 Jan., 20:26, Mathias Gaunard <loufo...(a)gmail.com> wrote:

> > uint_least16_t and uint_least32_t work just as well for that.
> > Sure, it doesn't have the semantic attached to it, but that's not
> > needed to hold elements.
>
> Though, there is a difference between uint_least16_t and char16_t. The
> first is just an alias of some integer type while the second is a
> distinct type. I'm not sure how important this is in reality but it
> affects overloading, for example. Just wanted to mention this.

Which is one of the reasons I need the reach char16_t and char32_t.
My code is type-driven, and being network-oriented, numerical type
codes for char16_t and char32_t must remain invariant from one network
node to another.

What disturbs me is that, within the next few months, I will be forced
to commit. I will have to choose wchar_t or char16_t, but as char16_t
is not available, and there is no indication of when it might become
available, I must use wchar_t for now, but will not be able to change
to char16_t when it becomes available without a total recall of all
deployed network software.

Patchwork-trickery of various kinds that one might imagine to
circumvent this issue do not seem to work in my heavily type-driven
code. :(

-Le Chaud Lapin-


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Jerry Coffin on
In article <20b7032a-896f-4702-b9b8-62d164ec5474
@h9g2000yqa.googlegroups.com>, jaibuduvin(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.

--
Later,
Jerry.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]