Re: Unicode -- issues and recommendations [repost]
David Hopwood <[email protected]> Tue, 06 Sep 2005 14:14:46 +0100
| Newsgroups | gmane.comp.lang.c-- |
|---|---|
| Message-ID | <[email protected]> |
Jonathan S. Shapiro wrote:
> Character Size:
>
> I don't think that C-- can take a position on character size.
I don't see why we would want it to. C-- defines types sufficient
to represent Unicode code units (bits8 for UTF-8, bits16 for UTF-16,
bits32 for UTF-32) and code points (bits32). Strings are a higher-level
issue that should be left to front-ends and libraries.
As for literals, I would add 16-bit and 32-bit array literals:
"..."
"..."::bits8[] same as "..."
"..."::bits16[] also allows \uHHHH escapes
"..."::bits32[] also allows \uHHHH and \UHHHHHHHH escapes
These don't have to be used only for strings, and there is no validation
of whether a literal is valid UTF-{8,16,32}; it is up to the front-end to
enforce that if needed.
Note that, like C99 but unlike Java, \uHHHH is only valid in literals, it
is not expanded before lexing.
I would not add any additional character literals; it is sufficient to use
integers.
--
David Hopwood <[email protected]>