Skip to main content

IAR Embedded Workbench for Arm 9.70.x

MISRAC2012-Rule-8.16

In this section:
Synopsis

(Advisory) The alignment specification of zero should not appear in an object declaration.

Enabled by default

No

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

Found alignment specification of zero.

Coding standards
MISRA C:2012 Rule-8.16

(Advisory) The alignment specification of zero should not appear in an object declaration

Code examples

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

#include <stdint.h>
#include <stdalign.h>

alignas (0) int32_t c; /* Non-compliant: zero-alignment specification */

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

#include <stdint.h>
#include <stdalign.h>

int32_t a; /* Compliant: no alignment specification */
alignas (16) int32_t b; /* Compliant: explicit non-zero alignment specification */