Are dollar-signs allowed in identifiers in C++03?

前端 未结 7 2377
深忆病人
深忆病人 2020-12-03 14:38

What does the C++ standard say about using dollar signs in identifiers, such as Hello$World? Are they legal?

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 14:50

    The relevant section is "2.8 Identifiers [lex.name]". From the basic character set, the only valid characters are A-Z a-z 0-9 and _. However, characters like é (U+00E9) are also allowed. Depending on your compiler, you might need to enter é as \u00e9, though.

提交回复
热议问题