Skip to main content

IAR Embedded Workbench for Arm 9.70.x

MISRAC++2023-10.0.1

In this section:
Synopsis

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

Enabled by default

No

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Multiple variables in a single declaration may cause a developer to misinterpret code when it comes to the type of such variables This check is identical to CERT-DCL04-C, MISRAC++2008-8-0-1.

Coding standards
CERT DCL04-C

Do not declare more than one variable per declaration

MISRA C++ 2008 8-0-1

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

Code examples

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

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

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

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