Previous Table of Contents "New C Standard" commentary
472 The meaning of a value stored in an object or returned by a function is determined by the type of the expression used to access it.
473 (An identifier declared to be an object is the simplest such expression;
474 the type is specified in the declaration of the identifier.)
475 Types are partitioned into object types (types that fully describe objects), function types (types that describe functions), and incomplete types (types that describe objects but lack information needed to determine their sizes).
An object declared as type
An object declared as type
If a member of the basic execution character set is stored in a
If any other character is stored in a
There are five standard signed integer types, designated as
481 (These and other types may be designated in several additional ways, as described in 6.7.2.)
482 There may also be implementation-defined extended signed integer types.28)
483 The standard and extended signed integer types are collectively called signed integer types.29)
An object declared as type
For each of the signed integer types, there is a corresponding (but
different) unsigned integer type (designated with the keyword
488 The unsigned integer types that correspond to the extended signed integer types are the extended unsigned integer types.
489 The standard and extended unsigned integer types are collectively called unsigned integer types.30)
490 28) Implementation-defined keywords shall have the form of an identifier reserved for any use as described in 7.1.3.
491 29) Therefore, any statement in this Standard about signed integer types also applies to the extended signed integer types.
492 30) Therefore, any statement in this Standard about unsigned integer types also applies to the extended unsigned integer types.
493 The standard signed integer types and standard unsigned integer types are collectively called the standard integer types, the extended signed integer types and extended unsigned integer types are collectively called the extended integer types.
494 For any two integer types with the same signedness and different integer conversion rank (see 188.8.131.52), the range of values of the type with smaller integer conversion rank is a subrange of the values of the other type.
495 The range of nonnegative values of a signed integer type is a subrange of the corresponding unsigned integer type, and the representation of the same value in each type is the same.31)
496 A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type.
There are three real floating types, designated as
The set of values of the type
the set of values of the type
There are three complex types, designated as
501 The real floating and complex types are collectively called the floating types.
502 For each floating type there is a corresponding real type, which is always a real floating type.
503 For real floating types, it is the same type.
For complex types, it is the type given by deleting the keyword
505 Each complex type has the same representation and alignment requirements as an array type containing exactly two elements of the corresponding real type;
506 the first element is equal to the real part, and the second element to the imaginary part, of the complex number.
508 Even if the implementation defines two or more basic types to have the same representation, they are nevertheless different types.34)
509 31) The same representation and alignment requirements are meant to imply interchangeability as arguments to functions, return values from functions, and members of unions.
510 32) See future language directions (6.11.1).
511 33) A specification for imaginary types is in informative annex G.
512 34) An implementation may define new keywords that provide alternative ways to designate a basic (or any other) type;
513 this does not violate the requirement that all basic types be different.
514 Implementation-defined keywords shall have the form of an identifier reserved for any use as described in 7.1.3.
The three types
The implementation shall define
517 An enumeration comprises a set of named integer constant values.
518 Each distinct enumeration constitutes a different enumerated type.
520 The integer and real floating types are collectively called real types.
521 Integer and floating types are collectively called arithmetic types.
522 Each arithmetic type belongs to one type domain: the real type domain comprises the real types, the complex type domain comprises the complex types.
524 it is an incomplete type that cannot be completed.
525 Any number of derived types can be constructed from the object, function, and incomplete types, as follows:
526 An array type describes a contiguously allocated nonempty set of objects with a particular member object type, called the element type.36)
527 Array types are characterized by their element type and by the number of elements in the array.
528 An array type is said to be derived from its element type, and if its element type is T, the array type is sometimes called array of T.
529 The construction of an array type from an element type is called array type derivation.
530 A structure type describes a sequentially allocated nonempty set of member objects (and, in certain circumstances, an incomplete array), each of which has an optionally specified name and possibly distinct type.
531 A union type describes an overlapping nonempty set of member objects, each of which has an optionally specified name and possibly distinct type.
532 A function type describes a function with specified return type.
533 A function type is characterized by its return type and the number and types of its parameters.
534 A function type is said to be derived from its return type, and if its return type is T, the function type is sometimes called function returning T.
535 The construction of a function type from a return type is called function type derivation.
Irrespective of the choice made,
538 36) Since object types do not include incomplete types, an array of incomplete type cannot be constructed.
539 A pointer type may be derived from a function type, an object type, or an incomplete type, called the referenced type.
540 A pointer type describes an object whose value provides a reference to an entity of the referenced type.
541 A pointer type derived from the referenced type T is sometimes called pointer to T.
542 The construction of a pointer type from a referenced type is called pointer type derivation.
543 These methods of constructing derived types can be applied recursively.
544 Arithmetic types and pointer types are collectively called scalar types.
545 Array and structure types are collectively called aggregate types.37)
546 An array type of unknown size is an incomplete type.
547 It is completed, for an identifier of that type, by specifying the size in a later declaration (with internal or external linkage).
549 A structure or union type of unknown content (as described in 184.108.40.206) is an incomplete type.
550 It is completed, for all declarations of that type, by declaring the same structure or union tag with its defining content later in the same scope.
551 Array, function, and pointer types are collectively called derived declarator types.
552 A declarator type derivation from a type T is the construction of a derived declarator type from T by the application of an array-type, a function-type, or a pointer-type derivation to T.
553 A type is characterized by its type category, which is either the outermost derivation of a derived type (as noted above in the construction of derived types), or the type itself if the type consists of no derived types.
554 Any type so far mentioned is an unqualified type.
Each unqualified type has several qualified versions of its
type,38) corresponding to the combinations of one, two, or
all three of the
556 The qualified or unqualified versions of a type are distinct types that belong to the same type category and have the same representation and alignment requirements.39)
557 A derived type is not qualified by the qualifiers (if any) of the type from which it is derived.
A pointer to
559 Similarly, pointers to qualified or unqualified versions of compatible types shall have the same representation and alignment requirements.
560 All pointers to structure types shall have the same representation and alignment requirements as each other.
561 All pointers to union types shall have the same representation and alignment requirements as each other.
562 Pointers to other types need not have the same representation or alignment requirements.
563 37) Note that aggregate type does not include union type because an object with union type can only contain one member at a time.
564 38) See 6.7.3 regarding qualified array and function types.
565 39) The same representation and alignment requirements are meant to imply interchangeability as arguments to functions, return values from functions, and members of unions.
The type designated as
The type designated as
568 Forward references: compatible type and composite type (6.2.7), declarations (6.7).
Created at: 2008-01-30 02:39:40
The text from WG14/N1256 is copyright © ISO
Created at: 2008-01-30 02:39:40 The text from WG14/N1256 is copyright © ISO