The __alignof__ operator
Beginning of IBM® Extension.
The __alignof__ operator is a language extension
to C99 and Standard C++ that returns the number of bytes used in the
alignment of its operand. The operand can be an expression or a parenthesized
type identifier. If the operand is an expression representing an lvalue,
the number returned by __alignof__ represents the
alignment that the lvalue is known to have. The type of the expression
is determined at compile time, but the expression itself is not evaluated.
If the operand is a type, the number represents the alignment usually
required for the type on the target platform.
__alignof__ operator may not be applied to
the following: - An lvalue representing a bit field
- A function type
- An undefined structure or class
- An incomplete type (such as
void)
If type-id is a reference or a referenced type, the result is the alignment of the referenced type. If type-id is an array, the result is the alignment of the array element type. If type-id is a fundamental type, the result is implementation-defined.
End of IBM Extension.
