来自C99规范的WG14/N1124草案第6.4.2节“标识符”:
identifier:
identifier-nondigit
identifier identifier-nondigit
identifier digit
identifier-nondigit:
nondigit
universal-character-name
other implementation-defined characters
并且§6.4.3,“通用字符名称”:
universal-character-name:
\u hex-quad
\U hex-quad hex-quad
这似乎表明像foo\u00AAbar
这样的标识符在语法上是有效的。我没有找到任何语义上的东西表明不是这样。然而,GCC甚至不尝试解析就拒绝了这样的标识符:
<stdin>:2: error: stray ‘\’ in program
<stdin>:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘u00AAbar’
<stdin>:2: error: ‘u00AAbar’ undeclared (first use in this function)
这是GCC、C99标准还是我的推理失误?