Possible Duplicate:
C++ source in unicode
I just discovered this line of code in a project:
string überwachung;
I was surprised, because actually I thought you are not allowed to use umlauts like ‘äöü’ in C++ code other than in strings and so on, and it would result in a compiler error. But this compiles just fine with visual studio 2008.
- Is this a special microsoft feature, or are umlauts allowed with other compilers too?
- Are there any potential problems with that (portability,system language settings..)?
- I can clearly remember this was not allowed. When did it change?
Kind regards for any clarification
P.S.: the tool cppcheck will even mark this usage as an error, even though it compiles
GCC complains on it:
codepad
The C++ language standard itself limits the basic source character set to 91 printable characters plus tabs, form feed and new-line, which are all within ASCII. However, there’s a nice footnote:
.. translation phase 1 is (emphasis mine)
Generally, you shouldn’t use umlauts or other special characters in your code. If may work, but if it does, it’s a compiler-specific feature.