What is use of universal character names in identifiers in C++

Posted by Jan Hudec on Programmers See other posts from Programmers or by Jan Hudec
Published on 2012-09-25T14:45:58Z Indexed on 2012/09/26 9:51 UTC
Read the original article Hit count: 292

Filed under:
|

The C++ standard (I noticed it in the new one, but it did already exist in C++03) specifies universal character names, written as \uNNNN and \UNNNNNNNN and representing the characters with unicode codepoints NNNN/NNNNNNNN. This is useful with string literals, especially since explicitly UTF-8, UTF-16 and UCS-4 string literals are also defined. However, the universal character literals are also allowed in identifiers. What is the motivation behind that?

The syntax is obviously totally unreadable, the identifiers may be mangled for the linker and it's not like there was any standard function to retrieve symbols by name anyway. So why would anybody actually use an identifier with universal character literals in it?

Edit: Since it actually existed in C++03 already, additional question would be whether you actually saw a code that used it?

© Programmers or respective owner

Related posts about c++

Related posts about c++11