Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC2012-Rule-6.3

In this section:
Synopsis

(Required) A bit field shall not be declared as a member of a union.

Enabled by default

Yes

Severity/Certainty

Low/High

lowhigh.png
Full description

A bit field member in a union was found.

Coding standards
MISRA C:2012 Rule-6.3

(Required) A bit field shall not be declared as a member of a union

Code examples

The following code example fails the check and will give a warning:

union U2 {
 int small:8;
 int big;
};

The following code example passes the check and will not give a warning about this issue:

union U1 {
 int small;
 long int big;
};