Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unions and BitFields
#3
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.
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Messages In This Thread
Unions and BitFields - by [email protected] - 05-07-2022, 03:26 PM
RE: Unions and BitFields - by PeterSommerlad - 08-07-2022, 11:04 AM
RE: Unions and BitFields - by misra cpp - 08-07-2022, 11:04 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)