Storage-class specifiers

来自cppreference.com

 
 
C语言编写
大会的主题
Original:
General topics
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
预处理器
评论
关键字
ASCII表
转义序列
C
流量控制
Original:
Flow control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
条件执行语句
Original:
Conditional execution statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
迭代语句
Original:
Iteration statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
跳转语句
Original:
Jump statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
功能
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
函数声明
的历史。内嵌说明
类型
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
规范
Original:
Specifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
CV符
存储类说明
alignas说明 (C99)
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
表达式
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
为了评价
其他运营商
运营商
运算符的优先级
实用工具
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
typedef declaration
属性 (C99)
转换
杂项
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
内联汇编
 
  • auto - 自动持续时间没有联系.
    Original:
    auto - automatic duration with no linkage.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • register - 自动持续时间没有联系。也暗示编译器将处理器的寄存器中的变量.
    Original:
    register - automatic duration with no linkage. Also hints to the compiler to place the variable in the processor's register.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • static - 静态持续时间的内部联动.
    Original:
    static - static duration with internal linkage.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • extern - 静态持续时间的内部或更通常是外部的联动.
    Original:
    extern - static duration with either internal or more usually external linkage.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • _Thread_local - (C11 起) - 的线程存储时间.
    Original:
    _Thread_local - (C11 起) - thread storage duration.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

目录

[编辑] 解释

[编辑] 储存时间

在一个程序中的所有变量有以下存储的持续时间决定了它的寿命
Original:
All variables in a program have one of the following storage durations that determines its lifetime:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • 自动'的存储时间。该变量被分配在封闭的代码块的开头和结束时将释放。这是默认情况下,所有的变量,申报者外staticextern_Thread_local.
    Original:
    automatic storage duration. The variable is allocated at the beginning of the enclosing code block and deallocated at the end. This is the default for all variables, except those declared static, extern or _Thread_local.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • '“静态”的存储时间。变量在程序开始时分配和释放程序结束时。只有一个实例变量的存在。声明的变量staticextern有此存储时间.
    Original:
    static storage duration. The variable is allocated when the program begins and deallocated when the program ends. Only one instance of the variable can exist. Variables declared with static or extern have this storage duration.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • “”线“”的存储时间(C11 起)。变量线程开始时分配和释放的线程结束时。每个线程都有它自己的实例的变量。只有声明的变量_Thread_local有这样的存储时间。 _Thread_local声明的变量只能被声明为staticextern,不能用在函数声明中.....
    Original:
    thread storage duration (C11 起). The variable is allocated when the thread begins and deallocated when the thread ends. Each thread has its own instance of the variable. Only variables declared _Thread_local have this storage duration. _Thread_local can only be declared for variables declared with static or extern and cannot be used in a function declaration.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • “”分配“的存储时间。该变量被分配和释放的每个请求使用动态内存分配功能的.
    Original:
    allocated storage duration. The variable is allocated and deallocated per request by using 动态内存分配 functions.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

[编辑] 联动

连接是指一个变量或函数被称为在其他范围内的能力。如果具有相同标识符的变量或函数的声明在几个范围,但不能被称为从所有这些,那么所产生的几个实例变量。以下联系确认
Original:
Linkage refers to the ability of a variable or function to be referred to in other scopes. If a variable or function with the same identifier is declared in several scopes, but cannot be referred to from all of them, then several instances of the variable are generated. The following linkages are recognized:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • 没有任何联系“。”可以被称为变量的范围是自动,线程和动态存储时间长。所有的变量,这种联系.....
    Original:
    no linkage. The variable can be referred to only from the scope it is in. All variables with automatic, thread and dynamic storage durations have this linkage.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • 内部联动。变量可以被称为当前转换单元中的所有范围。所有的变量所宣派static有这种联系.
    Original:
    internal linkage. The variable can be referred to from all scopes in the current translation unit. All variables which are declared static have this linkage.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • 外部链接。变量可以被称为整个程序中的任何其他翻译单位。所有变量声明为externconst没有明确的存储类说明符,但不static,这种联系.....
    Original:
    external linkage. The variable can be referred to from any other translation units in the entire program. All variables which are declared either extern or const with no explicit storage-class specifier, but not static, have this linkage.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

[编辑] 关键字

auto, register, static, extern, _Thread_local

[编辑] 为例