p2sr / mdp

mlugg's demo parser
The Unlicense
1 stars 2 forks source link

Incorrect enum value declaration for `SAR_DATA_INVALID` #4

Closed NeKzor closed 3 months ago

NeKzor commented 11 months ago

It's UB to define a higher value first SAR_DATA_CHECKSUM (0xFF) and then a lower value next SAR_DATA_CHECKSUM_V2 (0xFE) because the compiler might just define 0xFF again for SAR_DATA_INVALID.

https://github.com/p2sr/mdp/blob/4a580f63eb5c70bd1371153f2ff1ad219a1598fa/src/demo.h#L32-L35

See the result on compiler explorer: https://godbolt.org/z/x68qKGff3