08-07-2022, 11:04 AM
The code uses a union, so it's never going to be compliant with 9-5-1, but may be acceptable with a deviation.
The type-punning in your example is undefined behaviour.
Additionally, packing of the bitfields is going to be heavily dependant on the implementation, e.g. : packing,
alignment, endian-ness, size etc. However, your compiler vendor may define all these properties, but that needs to be verified
and documented in the deviation.
The type-punning in your example is undefined behaviour.
Additionally, packing of the bitfields is going to be heavily dependant on the implementation, e.g. : packing,
alignment, endian-ness, size etc. However, your compiler vendor may define all these properties, but that needs to be verified
and documented in the deviation.
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group