This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Revision 3: utf-16 and utf-32 support in C and C++
On Fri, Apr 18, 2008 at 01:07:58PM -0400, Jakub Jelinek wrote:
> On Fri, Apr 18, 2008 at 03:14:42PM +0200, Holger Hopp wrote:
> > I have detected that some parts are incomplete.
> > For example,
> >
> > char16_t *c16p = u"Hello World";
> >
> > works fine, but
> >
> > char16_t c16[] = u"Hello World";
> >
> > produces an error message. Ditto for char32_t.
>
> Works fine here (the first one with a warning, as it should be
> const char16_t *) with what has been committed.
Actually, it does work in C++ (albeit with a remaining bug because it shouldn't
be possible to assign a U"..." literal to a char16_t array).
But in C, it is producing an error message. I'm working on fixing that right
now. Note that the behaviour between C and C++ is expected to be different
since char16_t and char32_t are fundamental types in C++, yet typedefs in C.
As a side-effect, in C the following would be perfectly fine (albeit not very
useful):
wchar_t s[] = u"ab";
when compiling with -fshort-wchar, because in that case the underlying types
for char16_t and wchar_t are identical.
Kris