05-07-2022, 03:26 PM
Regarding usage of bitfields and enum, it is mention thta in certain cases it can be acceptable.
Rule 9-5-1 : Could you please explain what it means by "all relevant implementation-defined behavious is documented"
Rule 9-6-1 : Could you please see if the following code example would be compliant.
For exemple would the following code be acceptable with a deviation justification:
typedef unsigned int ubitfield_t;
union EventSource
{
EventSource() { Reset(); }
void Reset() { all[0] = 0; }
uint32_t all[1];
struct EventSourceBits
{
ubitfield_t unused : 28;
ubitfield_t unknownId : 1;
ubitfield_t InvalidHeader : 1;
ubitfield_t wrongCRC : 1;
ubitfield_t incompatible : 1;
} bits;
};
Regards,
Charles
Rule 9-5-1 : Could you please explain what it means by "all relevant implementation-defined behavious is documented"
Rule 9-6-1 : Could you please see if the following code example would be compliant.
For exemple would the following code be acceptable with a deviation justification:
typedef unsigned int ubitfield_t;
union EventSource
{
EventSource() { Reset(); }
void Reset() { all[0] = 0; }
uint32_t all[1];
struct EventSourceBits
{
ubitfield_t unused : 28;
ubitfield_t unknownId : 1;
ubitfield_t InvalidHeader : 1;
ubitfield_t wrongCRC : 1;
ubitfield_t incompatible : 1;
} bits;
};
Regards,
Charles