C语言标准-标识符的链接-linkages of identifiers
2022/1/7 23:05:09
本文主要是介绍C语言标准-标识符的链接-linkages of identifiers,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
linkages of identifiers
标识符的链接
An identifier declared in different scopes or in the same scope more than once can be made to refer to the same object or function by a process called linkage. 29) There are three kinds of linkage: external, internal, and none
不同作用域下声明的标识符 或者在同一作用域下面声明多次的标识符,在一个处理过程中可以指示同一个对象或者函数,这个处理过程叫做 linkage。 注: 不同的标识符之间不存在linkage。
有三种类型的 linkage
external
internal
none
In the set of translation units and libraries that constitutes an entire program, each declaration of a particular identifier with external linkage denotes the same object or function. Within one translation unit, each declaration of an identifier with internal linkage denotes the same object or function. Each declaration of an identifier with no linkage denotes a unique entity
组成程序的所有翻译单元和库中,拥有 external linkage的标识符 指示 同一个对象或函数。
在一个 翻译单元 内部,拥有 internal linkage 的标识符 指示 同一个对象或函数。
拥有 none linkage 的标识符,每个都指示一个独立的实体。
If the declaration of a file scope identifier for an object or a function contains the storage-class specifier static, the identifier has internal linkage.
具有 文件作用域的标识符,包含 static 修饰符,这个标识符 具有 internal linkage
For an identifier declared with the storage-class specifier extern in a scope in which a prior declaration of that identifier is visible, if the prior declaration specifies internal or external linkage, the linkage of the identifier at the later declaration is the same as the linkage specified at the prior declaration. If no prior declaration is visible, or if the prior declaration specifies no linkage, then the identifier has external linkage
在一个作用域内,一个之前出现的标识符,后面被 extern 修饰,如果前面一次是 internal或 external linkage, 后面一次的linkage 类型和前面的相同。
如果之前没出现过,或者前面出现时是 none linkage 类型,则后面一次是 external linkage 类型。
If the declaration of an identifier for a function has no storage-class specifier, its linkage is determined exactly as if it were declared with the storage-class specifier extern. If the declaration of an identifier for an object has file scope and no storage-class specifier, its linkage is external.
函数没指定 storage-class 时,它等同于 使用 extern 修改的函数。具有 文件作用域的对象的标识符 没指定 storage-class ,则它是 external linkage 类型。
The following identifiers have no linkage: an identifier declared to be anything other than an object or a function; an identifier declared to be a function parameter; a block scope identifier for an object declared without the storage-class specifier extern
下列标识符 属于 none linkage 类型:
1、 既不是函数,也不是对象的标识符。
2、 函数参数标识符
3、 块作用域的对象标识符,没有使用extern 修饰。
If, within a translation unit, the same identifier appears with both internal and external linkage, the behavior is undefined.
在一个翻译单元内,同一个标识符 即以 internal linkage 出现又以 external linkage 出现,其行为未定义。
这篇关于C语言标准-标识符的链接-linkages of identifiers的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-25TypeScript基础知识详解
- 2024-12-25安卓NDK 是什么?-icode9专业技术文章分享
- 2024-12-25caddy 可以定义日志到 文件吗?-icode9专业技术文章分享
- 2024-12-25wordfence如何设置密码规则?-icode9专业技术文章分享
- 2024-12-25有哪些方法可以实现 DLL 文件路径的管理?-icode9专业技术文章分享
- 2024-12-25错误信息 "At least one element in the source array could not be cast down to the destination array-icode9专业技术文章分享
- 2024-12-25'flutter' 不是内部或外部命令,也不是可运行的程序 或批处理文件。错误信息提示什么意思?-icode9专业技术文章分享
- 2024-12-25flutter项目 as提示Cannot resolve symbol 'embedding'提示什么意思?-icode9专业技术文章分享
- 2024-12-24怎么切换 Git 项目的远程仓库地址?-icode9专业技术文章分享
- 2024-12-24怎么更改 Git 远程仓库的名称?-icode9专业技术文章分享