I am trying to use Unicode variable names in g++, but it does not appear to work.
Does g++ not support Unicode variable names? Or is there some subset of Unicode (from which I’m not testing in)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have to specify the
-fextended-identifiersflag when compiling. You also have to use \uXXXX or \uXXXXXXXX for Unicode (at least in GCC, it’s Unicode).Identifiers (variable/class names, etc.) in g++ can’t be of UTF-8/UTF-16 or whatever encoding. They have to be:
A nondigit is
And a universalcharactername is
Thus, if you save your source file as UTF-8, you cannot have a variable like:
It had to be written like:
(which, in my opinion, would defeat the purpose. So just stick with a-z)