c - C 中的非 ASCII 字符

标签 c namespaces naming-conventions ansi standards-compliance

我正在查看 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/

相关文章:

c - 链表中不兼容指针类型的赋值 (C)

c - 在 Linux 中使用 glut 调整窗口大小时显示错误

java - 位图/ Canvas 的使用和 NDK

java - 如何命名一个公开序列化和反序列化/编码解码方法的类

css - 区分 CSS 中的上下文相关类

c - 这些行汇编代码的目的是什么?

php - 如何用PHP获取SVG标签内容

php - 将 RecursiveIteratorIterator 与命名空间一起使用?

c++ - 愚蠢的 C++ 语法尚未声明

node.js - 当不同的服务都命名为 'server.js' 时,如何识别它们?