版本1和3间的区别 (跳过第2版)
于2007-07-18 22:43:54修订的的版本1
大小: 1913
编辑: czk
备注:
于2008-02-23 15:35:56修订的的版本3
大小: 1975
编辑: localhost
备注: converted to 1.6 markup
删除的内容标记成这样。 加入的内容标记成这样。
行号 1: 行号 1:
## page was renamed from TCPL/A.8.1 Storage Class Specifiers

A.8.1 Storage Class Specifiers

The storage class specifiers are:

  • storage-class specifier:
    • auto register static extern typedef

The meaning of the storage classes were discussed in Par.A.4.4.

The auto and register specifiers give the declared objects automatic storage class, and may be used only within functions. Such declarations also serve as definitions and cause storage to be reserved. A register declaration is equivalent to an auto declaration, but hints that the declared objects will be accessed frequently. Only a few objects are actually placed into registers, and only certain types are eligible; the restrictions are implementation-dependent. However, if an object is declared register, the unary & operator may not be applied to it, explicitly or implicitly.

  • The rule that it is illegal to calculate the address of an object declared register, but actually taken to be auto, is new.

The static specifier gives the declared objects static storage class, and may be used either inside or outside functions. Inside a function, this specifier causes storage to be allocated, and serves as a definition; for its effect outside a function, see Par.A.11.2.

A declaration with extern, used inside a function, specifies that the storage for the declared objects is defined elsewhere; for its effects outside a function, see Par.A.11.2.

The typedef specifier does not reserve storage and is called a storage class specifier only for syntactic convenience; it is discussed in Par.A.8.9.

At most one storage class specifier may be given in a declaration. If none is given, these rules are used: objects declared inside a function are taken to be auto; functions declared within a function are taken to be extern; objects and functions declared outside a function are taken to be static, with external linkage. See Pars. A.10-A.11.

TCPL/A.08.01_Storage_Class_Specifiers (2008-02-23 15:35:56由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.