Стандарт языка Си С99 TC (1113411), страница 9
Текст из файла (страница 9)
Forexample, if the widest type were to use the minimal-width IEC 60559 double-extended format (64 bits ofprecision), then DECIMAL_DIG would be 21.Forward references:conditional inclusion (6.10.1), complex arithmetic<complex.h> (7.3), extended multibyte and wide character utilities <wchar.h>(7.24), floating-point environment <fenv.h> (7.6), general utilities <stdlib.h>(7.20), input/output <stdio.h> (7.19), mathematics <math.h> (7.12).28Environment§5.2.4.2.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC36.
Language6.1 Notation1In the syntax notation used in this clause, syntactic categories (nonterminals) areindicated by italic type, and literal words and character set members (terminals) by boldtype. A colon (:) following a nonterminal introduces its definition. Alternativedefinitions are listed on separate lines, except when prefaced by the words ‘‘one of’’. Anoptional symbol is indicated by the subscript ‘‘opt’’, so that{ expressionopt }indicates an optional expression enclosed in braces.2When syntactic categories are referred to in the main text, they are not italicized andwords are separated by spaces instead of hyphens.3A summary of the language syntax is given in annex A.6.2 Concepts6.2.1 Scopes of identifiers1An identifier can denote an object; a function; a tag or a member of a structure, union, orenumeration; a typedef name; a label name; a macro name; or a macro parameter. Thesame identifier can denote different entities at different points in the program.
A memberof an enumeration is called an enumeration constant. Macro names and macroparameters are not considered further here, because prior to the semantic phase ofprogram translation any occurrences of macro names in the source file are replaced by thepreprocessing token sequences that constitute their macro definitions.2For each different entity that an identifier designates, the identifier is visible (i.e., can beused) only within a region of program text called its scope.
Different entities designatedby the same identifier either have different scopes, or are in different name spaces. Thereare four kinds of scopes: function, file, block, and function prototype. (A functionprototype is a declaration of a function that declares the types of its parameters.)3A label name is the only kind of identifier that has function scope. It can be used (in agoto statement) anywhere in the function in which it appears, and is declared implicitlyby its syntactic appearance (followed by a : and a statement).4Every other identifier has scope determined by the placement of its declaration (in adeclarator or type specifier).
If the declarator or type specifier that declares the identifierappears outside of any block or list of parameters, the identifier has file scope, whichterminates at the end of the translation unit. If the declarator or type specifier thatdeclares the identifier appears inside a block or within the list of parameter declarations ina function definition, the identifier has block scope, which terminates at the end of theassociated block. If the declarator or type specifier that declares the identifier appears§6.2.1Language29ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256within the list of parameter declarations in a function prototype (not part of a functiondefinition), the identifier has function prototype scope, which terminates at the end of thefunction declarator.
If an identifier designates two different entities in the same namespace, the scopes might overlap. If so, the scope of one entity (the inner scope) will be astrict subset of the scope of the other entity (the outer scope). Within the inner scope, theidentifier designates the entity declared in the inner scope; the entity declared in the outerscope is hidden (and not visible) within the inner scope.5Unless explicitly stated otherwise, where this International Standard uses the term‘‘identifier’’ to refer to some entity (as opposed to the syntactic construct), it refers to theentity in the relevant name space whose declaration is visible at the point the identifieroccurs.6Two identifiers have the same scope if and only if their scopes terminate at the samepoint.7Structure, union, and enumeration tags have scope that begins just after the appearance ofthe tag in a type specifier that declares the tag.
Each enumeration constant has scope thatbegins just after the appearance of its defining enumerator in an enumerator list. Anyother identifier has scope that begins just after the completion of its declarator.Forward references: declarations (6.7), function calls (6.5.2.2), function definitions(6.9.1), identifiers (6.4.2), name spaces of identifiers (6.2.3), macro replacement (6.10.3),source file inclusion (6.10.2), statements (6.8).6.2.2 Linkages of identifiers1An identifier declared in different scopes or in the same scope more than once can bemade to refer to the same object or function by a process called linkage.21) There arethree kinds of linkage: external, internal, and none.2In the set of translation units and libraries that constitutes an entire program, eachdeclaration of a particular identifier with external linkage denotes the same object orfunction.
Within one translation unit, each declaration of an identifier with internallinkage denotes the same object or function. Each declaration of an identifier with nolinkage denotes a unique entity.3If the declaration of a file scope identifier for an object or a function contains the storageclass specifier static, the identifier has internal linkage.22)4For an identifier declared with the storage-class specifier extern in a scope in which a21) There is no linkage between different identifiers.22) A function declaration can contain the storage-class specifier static only if it is at file scope; see6.7.1.30Language§6.2.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3prior declaration of that identifier is visible,23) if the prior declaration specifies internal orexternal linkage, the linkage of the identifier at the later declaration is the same as thelinkage specified at the prior declaration.
If no prior declaration is visible, or if the priordeclaration specifies no linkage, then the identifier has external linkage.5If the declaration of an identifier for a function has no storage-class specifier, its linkageis determined exactly as if it were declared with the storage-class specifier extern. Ifthe declaration of an identifier for an object has file scope and no storage-class specifier,its linkage is external.6The following identifiers have no linkage: an identifier declared to be anything other thanan object or a function; an identifier declared to be a function parameter; a block scopeidentifier for an object declared without the storage-class specifier extern.7If, within a translation unit, the same identifier appears with both internal and externallinkage, the behavior is undefined.Forward references: declarations (6.7), expressions (6.5), external definitions (6.9),statements (6.8).6.2.3 Name spaces of identifiers1If more than one declaration of a particular identifier is visible at any point in atranslation unit, the syntactic context disambiguates uses that refer to different entities.Thus, there are separate name spaces for various categories of identifiers, as follows:— label names (disambiguated by the syntax of the label declaration and use);— the tags of structures, unions, and enumerations (disambiguated by following any24)of the keywords struct, union, or enum);— the members of structures or unions; each structure or union has a separate namespace for its members (disambiguated by the type of the expression used to access themember via the .
or -> operator);— all other identifiers, called ordinary identifiers (declared in ordinary declarators or asenumeration constants).Forward references: enumeration specifiers (6.7.2.2), labeled statements (6.8.1),structure and union specifiers (6.7.2.1), structure and union members (6.5.2.3), tags(6.7.2.3), the goto statement (6.8.6.1).23) As specified in 6.2.1, the later declaration might hide the prior declaration.24) There is only one name space for tags even though three are possible.§6.2.3Language31ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12566.2.4 Storage durations of objects1An object has a storage duration that determines its lifetime.
There are three storagedurations: static, automatic, and allocated. Allocated storage is described in 7.20.3.2The lifetime of an object is the portion of program execution during which storage isguaranteed to be reserved for it. An object exists, has a constant address,25) and retainsits last-stored value throughout its lifetime.26) If an object is referred to outside of itslifetime, the behavior is undefined. The value of a pointer becomes indeterminate whenthe object it points to reaches the end of its lifetime.3An object whose identifier is declared with external or internal linkage, or with thestorage-class specifier static has static storage duration.