In C programming, the representation of all types is unspecified except as stated in the standard. Here, we will discuss the general and integer types.
General
- Objects: Except for bit-fields, objects are composed of contiguous sequences of one or more bytes. The number, order, and encoding of these bytes are either explicitly specified or implementation-defined.
- Unsigned Bit-fields and Char: Values stored in unsigned bit-fields and objects of type unsigned char are represented using a pure binary notation.
- Non-bit-field Objects: Values stored in non-bit-field objects consist of `n × CHAR_BIT` bits, where `n` is the size of an object of that type, in bytes.
- Trap Representation: Certain object representations need not represent a value of the object type. Such a representation is called a trap representation.
- Structure or Union Type: When a value is stored in an object of structure or union type, the bytes of the object representation that correspond to any padding bytes take unspecified values.
- Operator Application: 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.
- Atomic Types: Loads and stores of objects with atomic types are done with `memory_order_seq_cst` semantics.
Integer Types
- Unsigned Integer Types: For unsigned integer types other than unsigned char, the bits of the object representation are divided into two groups: value bits and padding bits.
- Signed Integer Types: For signed integer types, the bits of the object representation are divided into three groups: value bits, padding bits, and the sign bit.
- Negative Zeros: If the implementation supports negative zeros, they shall be generated only by certain operators.
- Padding Bits: The values of any padding bits are unspecified.
- Precision and Width: The precision of an integer type is the number of bits it uses to represent values, excluding any sign and padding bits. The width of an integer type is the same but including any sign bit.
C
// Forward references
declarations (6.7);
expressions (6.5);
lvalues, arrays, and function designators (6.3.2.1);
order and consistency (7.17.3);