Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unions and BitFields
#2
Type punning with unions is only sanctioned by the C++ standard in very special cases and not in the code you are showing.

If the union is only needed for Reset all bits to zero, this can be easily achieved by just using

Reset(){
bits = EventSourceBits{};
}
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)