- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我在无数 C/C++ 头文件和源文件中看到过这种情况。
除了个人喜好之外,这些不同符号中的每一个的含义是什么?
_NAME
__NAME
_NAME_
__NAME__
NAME_t
老实说,我唯一理解的是 _NAME
,它是一个类的私有(private)成员(至少在 C# 中是这样)。
有人能解释一下它们之间的区别吗?
如果有任何其他值得注意的符号,请提及它们(即使是其他类似的语言)。
谢谢!
最佳答案
以 _
或 __
开头的名称通常用于保留标识符,您不应定义/创建以该约定开头的标识符。 (_ 后面跟着大写字母)
来自 C99 标准,7.1.3 - “保留标识符”
— All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.
— All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces.
来自 C++03 标准(对 C++98 的修正),第 17.4.3.1.2 节 - “全局名称”
— Each name that contains a double underscore (_ _) or begins with an underscore followed by an upper- case letter (2.11) is reserved to the implementation for any use.
— Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace
关于c# - _NAME、__NAME、_NAME_、__NAME__ 等符号的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4270316/
我在无数 C/C++ 头文件和源文件中看到过这种情况。 除了个人喜好之外,这些不同符号中的每一个的含义是什么? _NAME __NAME _NAME_ __NAME__ NAME_t 老实说,我唯一理
我不知道我是不是瞎了或什么的,我正在检查 Django 文档、查询集,我看到了使用 __let、__name 等的做法,但我没有看到这些术语在哪里定义?你能帮我解决这个问题吗? 我正在检查所有这些:
所以我想实现 TinyMce 助手。我已按照 cakephp 面包店的说明进行操作,但仍然出现错误。 这是我的项目 Controller 中的 helpers 数组: var $helpers = a
我正在研究有关 Angular5 的入门套件,但在使用以下命令创建新组件时遇到了麻烦:“npm run nggenerate component component/exemple/user/user
我是一名优秀的程序员,十分优秀!