...
The sizeof
operator yields the size (in bytes) of its operand, which may be an expression or the parenthesized name of a type. In most cases, the operand is not evaluated. A possible exception is when the type of the operand is a variable length array type (VLA); then the expression is evaluated. When part of the operand of the sizeof operator is a VLA type and when changing the value of the VLA's size expression would not affect the result of the operator, it is unspecified whether or not the size expression is evaluated. (see See unspecified behavior 22.).
The operand passed to_Alignof
is never evaluated, despite not being an expression. For instance, if the operand is a VLA type and the VLA's size expression contains a side effect, that side effect is never evaluated.
...
This noncompliant code example attempts to modify a variable's value as part of the _Generic
selection control expression. The programmer may expect that a
is incremented, but because _Generic
does not evaluate its control expression, the the value of a
is not modified.
...