--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
On 15 September 2013 15:52, Eelis <ee...@eelis.net> wrote:
On 2013-09-15 14:50, Maurice Bos wrote:I think doing it by extending universal-character-name makes the most sense.
Should this only work inside string literals, or do you want to modify
the 'universal-character-name' grammer to allow this in identifiers as
well? (just like \uXXXX)
You know.. I guess doing this stuff with a user-defined literal would be one option.
It would look like "\u{PER MILLE SIGN}"_symbolic_unicode ;)
std::cout << "\uFF11" /* FULLWIDTH DIGIT ONE */ "\u2030" /* PER MILLE SIGN */;
#define S(X) #X
S("\u{DIGIT ZERO}") // => "\"\\u{DIGIT ZERO}\"
On 15 September 2013 15:25, Eelis <ee...@eelis.net> wrote:Wouldn't it be nice to be able to use Unicode character names in universal-character-names?
std::cout << "\u{PER MILLE SIGN}";
I think this better expresses the intent than "\u2030".Seems like a good idea. I played with some work-around ideas, and they.. ..don't work:
#define PER_MILLE_SIGN "\u2030"
#define CODEPOINT_(x) * U ## x // Prepend char32_t prefix, get first element of string literal.
#define CODEPOINT(x) CODEPOINT_(x) // Tame catenation operator.
wchar_t *s1 = L"" PER_MILLE_SIGN;
char *s2 = "123 " PER_MILLE_SIGN;
char16_t c{ CODEPOINT( PER_MILLE_SIGN ) }; // Narrowing safe; CODEPOINT is constant expression.
Any kind of define would require string literal concatenation anyway, so it's never going to be as nice
as "\u{name}".
Wouldn't it be nice to be able to use Unicode character names in universal-character-names?
std::cout << "\u{PER MILLE SIGN}";
I think this better expresses the intent than "\u2030".
I think it's a very good idea. Many other languages have it, and it's a simple and localized change.
On terça-feira, 17 de setembro de 2013 19:36:39, Eelis wrote:Obviously the macro does not mean that character names are permitted because
> > It only requires the compiler to have a full list of character names from
> > the Unicode database. It will also require the C++ standard to mandate a
> > minimum version of Unicode, update it once in a while, provide a macro to
> > indicate which version of Unicode is known, etc.
>
> Such a macro already exists: __STDC_ISO_10646__.
they aren't right now. We can change the meaning of the macro and have it
contain a value that indicates the version of Unicode that is supported by the
compiler.
Am Sonntag, 15. September 2013 17:34:08 UTC+2 schrieb Philipp StephaniI think it's a very good idea. Many other languages have it, and it's a simple and localized change.Name a few please. I am not aware of a single one and a quick search on google did not give any results.
(a) some examples of actual code using this feature to good effect in Perl or Python
#define PER_MILLE_SIGN "\u2030"
#define CODEPOINT_(x) * U ## x // Prepend char32_t prefix, get first element of string literal.
#define CODEPOINT(x) CODEPOINT_(x) // Tame catenation operator.
wchar_t *s1 = L"" PER_MILLE_SIGN;
char *s2 = "123 " PER_MILLE_SIGN;
char16_t c{ CODEPOINT( PER_MILLE_SIGN ) }; // Narrowing safe; CODEPOINT is constant expression.