Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2012-Rule-7.5

In this section:
Synopsis

(Mandatory) The argument of an integer constant macro shall have an appropriate form.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Integer macro with inappropriate form found.

Coding standards
MISRA C:2012 Rule-7.5

(Mandatory) The argument of an integer constant macro shall have an appropriate form

Code examples

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

#include <stdint.h>

uint32_t u1 = UINT32_C( 10UL ); /* Non-compliant - constant is suffixed */

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

#include <stdint.h>

uint32_t u2 = UINT32_C( 10 ); /* Compliant */