It is possible in the same statement, to declare a user-defined type (class
, struct
, union
or
enum
) followed by variable declarations of this type. But mixing more than one concern in a single statement is confusing for
maintainers.
This rule raises an issue when a variable is declared at the end of a user-defined type declaration statement.
Noncompliant code example
struct Container { int size; } container; // Noncompliant
Compliant solution
struct Container { int size; };
Container container;