我正在查看 google go 的运行时源代码(在 https://go.googlecode.com/hg/src/pkg/runtime/ ),他们似乎在函数名称中使用了一个特殊字符,·。 (例如,查看 https://go.googlecode.com/hg/src/pkg/runtime/cgocall.c )。这是否被主要编译器接受?这不是 ANSI C,是吗?或者它只是一些宏观魔法?
谢谢!
最佳答案
C90 不允许在标识符中添加其他字符(超过基本字符集中的字符),C99 允许(使用通用字符语法 --\uXXXX 和\UXXXXXXXX -- 以及实现定义的其他字符集)。
C99 中的 6.4.2.1/1:
identifier:
identifier-nondigit
identifier identifier-nondigit
identifier digit
identifier-nondigit:
nondigit
universal-character-name
other implementation-defined characters
nondigit: one of
_ a b c d e f g h i j k l m
n o p q r s t u v w x y z
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
digit: one of
0 1 2 3 4 5 6 7 8 9
我不知道 C 实现对它的支持程度如何,我知道 Plan9 C 编译器 could handle other characters在标准化之前。
关于c - C 中的非 ASCII 字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8564148/