Skip to main content

IAR Embedded Workbench for Arm 9.70.x

MISRAC++2008-8-0-1

In this section:
Synopsis

(Required) An init-declarator-list or a member-declarator-list shall consist of a single init-declarator or member-declarator respectively.

Enabled by default

Yes

Severity/Certainty

Low/High

lowhigh.png
Full description

There are declarations that contain more than one variable or constant each. This check is identical to CERT-DCL04-C, MISRAC++2023-10.0.1.

Coding standards
CERT DCL04-C

Do not declare more than one variable per declaration

MISRA C++ 2023 10.0.1

(Advisory) A declaration should not declare more than one variable or member variable

Code examples

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

int foo(){
  int a,b,c;
}

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

int foo(){
  int a; int b; int c;
}