IBM extension

The __alignof__ operator

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.

The __alignof__ operator may not be applied to the following:

Read syntax diagramSkip visual syntax diagram__alignof__ operator syntax
 
>>-__alignof__--+-unary_expression-+---------------------------><
                '-(--type-id--)----'
 

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.

Related information

End of IBM extension


[ Top of Page | Previous Page | Next Page | Contents | Index ]