Sharing some naming conventions enables teams to collaborate more efficiently. This rule checks that all union
names and
union
type alias names match a provided regular expression.
Noncompliant code example
Using the default regular expression ^[A-Z][a-zA-Z0-9]*$
:
union my_union {
int one;
int two;
};
using my_other_union = union {
int one;
int two;
};
Compliant solution
union MyUnion {
int one;
int two;
};
using MyOtherUnion = union {
int one;
int two;
};
Exceptions
The rule ignores anonymous unions that are not type aliased.
// Compliant by exception
union {
int a;
bool b;
} u;