在C非ASCII字符 [英] Non-ASCII characters in C

查看:465
本文介绍了在C非ASCII字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(我一直在寻找在谷歌走的运行源$ C ​​$ c。在<一个href=\"https://go.google$c$c.com/hg/src/pkg/runtime/\">https://go.google$c$c.com/hg/src/pkg/runtime/ ),而且看起来他们使用特殊字符的函数名,·。 (查找,例如在<一个href=\"https://go.google$c$c.com/hg/src/pkg/runtime/cgocall.c\">https://go.google$c$c.com/hg/src/pkg/runtime/cgocall.c )。这是接受各主要的编译器?这不是ANSI C,是吗?或者这只是一些宏观的魔力?

I was looking at google go's runtime source code (at https://go.googlecode.com/hg/src/pkg/runtime/ ), and it seems they use a special character for their function names, · . (Look for example at https://go.googlecode.com/hg/src/pkg/runtime/cgocall.c ). Is this accepted across major compilers? It's not ANSI C, is it? Or is it just some macro magic?

感谢您!

推荐答案

C90不允许在标识符附加字符(超过那些在基本字符集),C99做的(既与通用字符语法 - 为\\ uXXXX和\\ UXXXXXXXX - 和实施定义的一组其它字符)

C90 doesn't allow additional character in identifier (over those in the basic characters set), C99 do (both with the universal character syntax -- \uXXXX and \UXXXXXXXX -- and an implementation defined set of other characters).

在6.4.2.1/1 C99:

6.4.2.1/1 in C99:

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编译器<一个href=\"https://plus.google.com/u/0/101960720994009339267/posts/Snbs1Mr9CEv#101960720994009339267/posts/Snbs1Mr9CEv\"相对=nofollow>可以处理其他字符该被标准化了。

这篇关于在C非ASCII字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆