Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC++2023-12.2.1 (C++ only)

In this section:
Synopsis

(Advisory) Bit-fields should not be declared

Enabled by default

No

Severity/Certainty

Low/High

lowhigh.png
Full description

Bit-fields has a number of implementation defined aspects and should thus be avoided.

Coding standards

This check does not correspond to any coding standard rules.

Code examples

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

struct example
{
  short low  : 8; // Non-compliant
  short high : 8; // Non-compliant
};

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

#include <cstdint>

struct example
{
  std::uint8_t low;  // Compliant
  std::uint8_t high; // Compliant
};