14-06-2017, 08:37 AM
The MISRA-C working group agrees that the wording of the exception could be improved. The aim of the exception was to permit expressions with a volatile type, but not if the expression also contains a VLA declaration.
The exception should be interpreted as follows. sizeof(V) is permitted where V is an expression which:
1. Yields an lvalue with a volatile qualified type; and
2. Does not include a declaration of a variable-length array.
In conclusion, both a1 and a2 are compliant with this rule as the type being accessed is an "array type" not a volatile type.
The exception should be interpreted as follows. sizeof(V) is permitted where V is an expression which:
1. Yields an lvalue with a volatile qualified type; and
2. Does not include a declaration of a variable-length array.
In conclusion, both a1 and a2 are compliant with this rule as the type being accessed is an "array type" not a volatile type.
Posted by and on behalf of the MISRA C Working Group