The __alignof__ operator (IBM extension)
The __alignof__ operator is a language
extension to C99 and C++03 that
returns the position to which its operand is aligned.
The operand can be an expression or a parenthesized type identifier.
If the operand is an expression that represents an lvalue, the number
that is 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 that is usually
required for the type on the target platform.
__alignof__ operator cannot be applied
to the following situations: - An lvalue that represents 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.
