用于Objective-C文字和标识符的有效ASCII字符列表? [英] List of valid ASCII characters for Objective-C literals and identifiers?

查看:81
本文介绍了用于Objective-C文字和标识符的有效ASCII字符列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的这些变量名在xCode中都是有效的(编译器无需再考虑即可构建它们).

These variable names below are ALL VALID in xCode (compiler builds them without a second thought).

NSString * ª_name = @"something";
NSString * ø_name = @"something";
NSString * ƒ_name = @"something";
NSString * Ç_name = @"something";
NSString * ç_name = @"something";
NSString * º_name = @"something";
NSString * ı_name = @"something";
NSString * ·name = @"SHIFT+OPTION+9"; // Personal favourite
NSString * π_name = @"something";
NSString * æ_name = @"something";

在某个地方可以找到变量名的所有有效字符的列表吗?

Is there a list somewhere I can see all the valid characters I can use for a variable name?

编辑:其中许多实际上仍然 愚弄xCode索引 .因此最好坚持使用good'ol下划线. :)

Many of them still fools xCode indexing actually. So better to stick to good'ol underscore. :)

推荐答案

C90允许在标识符中使用63个众所周知的 ASCII 字符:拉丁大写和小写字母,数字和下划线.

C90 allows 63 well known ASCII characters in identifiers: Latin upper- and lowercase letters, digits and the underscore.

自C99起,在新版本中clang和gcc都支持扩展标识符"的概念. C99标准包含允许的通用字符".它有点长,所以我只复制拉丁范围:

Since C99 there's the notion of "extended identifiers" which are supported by both clang and gcc in newer versions. The C99 standard contains a list of allowed "universal characters" in Annex D. It's a bit long so I only copy the latin range:

00AA,00BA,00C0-0D6、00D8-0F6、00F8-01F5、01FA-0217、0250-02A8、1E00-1E9B,1EA0-1EF9、207F

00AA, 00BA, 00C0−00D6, 00D8−00F6, 00F8−01F5, 01FA−0217, 0250−02A8, 1E00−1E9B, 1EA0−1EF9, 207F

您最喜欢的中间点"(我也喜欢)可以在特殊字符"中找到:

Your favorite "middle dot" (which I like as well) is found in the "Special characters":

00B5、00B7、02B0-02B8、02BB,02BD-02C1、02D0-02D1、02E0-02E4、037A,0559、093D,0B3D,1FBE,203F-2040、2102、2107、210A-2113、2115、2118 −211D,2124、2126、2128、212A-2131, 2133−2138、2160−2182、3005-3007、3023-1029

00B5, 00B7, 02B0−02B8, 02BB, 02BD−02C1, 02D0−02D1, 02E0−02E4, 037A, 0559, 093D, 0B3D, 1FBE, 203F−2040, 2102, 2107, 210A−2113, 2115, 2118−211D, 2124, 2126, 2128, 212A−2131, 2133−2138, 2160−2182, 3005−3007, 3021−3029

这篇关于用于Objective-C文字和标识符的有效ASCII字符列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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