6.2.6.1 General

Previous Table of Contents

565 The representations of all types are unspecified except as stated in this subclause.

566 Except for bit-fields, objects are composed of contiguous sequences of one or more bytes, the number, order, and encoding of which are either explicitly specified or implementation-defined.

567 Values stored in unsigned bit-fields and objects of type unsigned char shall be represented using a pure binary notation.40)

568 Values stored in non-bit-field objects of any other object type consist of n × CHAR_BIT bits, where n is the size of an object of that type, in bytes.

569 The value may be copied into an object of type unsigned char [n] (e.g., by memcpy);

570 the resulting set of bytes is called the object representation of the value.

571 Values stored in bit-fields consist of m bits, where m is the size specified for the bit-field.

572 The object representation is the set of m bits the bit-field comprises in the addressable storage unit holding it.

573 Two values (other than NaNs) with the same object representation compare equal, but values that compare equal may have different object representations.

574 Certain object representations need not represent a value of the object type.

575 If the stored value of an object has such a representation and is read by an lvalue expression that does not have character type, the behavior is undefined.

576 If such a representation is produced by a side effect that modifies all or any part of the object by an lvalue expression that does not have character type, the behavior is undefined.41)

577 Such a representation is called a trap representation.

578 40) A positional representation for integers that uses the binary digits 0 and 1, in which the values represented by successive bits are additive, begin with 1, and are multiplied by successive integral powers of 2, except perhaps the bit with the highest position.

579 (Adapted from the American National Dictionary for Information Processing Systems.)

580 A byte contains CHAR_BIT bits, and the values of type unsigned char range from 0 to 2CHAR_BIT-1.

581 41) Thus, an automatic variable can be initialized to a trap representation without causing undefined behavior, but the value of the variable cannot be used until a proper value is stored in it.

582 When a value is stored in an object of structure or union type, including in a member object, the bytes of the object representation that correspond to any padding bytes take unspecified values.42)

583 The values of padding bytes shall not affect whether the value of such an object is a trap representation. The value of a structure or union object is never a trap representation, even though the value of a member of a structure or union object may be a trap representation.

584 Those bits of a structure or union object that are in the same byte as a bit-field member, but are not part of that member, shall similarly not affect whether the value of such an object is a trap representation.

585 When a value is stored in a member of an object of union type, the bytes of the object representation that do not correspond to that member but do correspond to other members take unspecified values, but the value of the union object shall not thereby become a trap representation.

586 Where an operator is applied to a value that has more than one object representation, which object representation is used shall not affect the value of the result.43)

587 Where a value is stored in an object using a type that has more than one object representation for that value, it is unspecified which representation is used, but a trap representation shall not be generated.

588 Forward references: declarations (6.7), expressions (6.5), lvalues, arrays, and function designators (6.3.2.1).

Next

Created at: 2005-06-29 02:18:55 The text from WG14/N1124 is copyright © ISO