...
| Code Block | ||||
|---|---|---|---|---|
| ||||
class B1 {
int val;
public:
B1(int val) : val(val) {}
};
class B2 {
int otherVal;
public:
B2(int otherVal) : otherVal(otherVal) {}
};
class D : B1, B2 {
public:
D(int a) : B1(a), B2(a) {}
}; |
Exceptions
OOP53-CPP-EX1EX0: Constructors that do not use member initializers do not violate this rule.Anchor OOP53-EX1EX0 OOP53-EX1EX0
Risk Assessment
Rule | Severity | Likelihood | Detectable | Remediation CostRepairable | Priority | Level |
|---|---|---|---|---|---|---|
OOP53-CPP | Medium | Unlikely | Yes | YesMedium | P4 P6 | L3 L2 |
Automated Detection
Tool | Version | Checker | Description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| initializer-list-order | Fully checked | |||||||||||
| Axivion Bauhaus Suite |
| CertC++-OOP53 | PRQA QA-C++ | |||||||||||
| Include Page | PRQA QA-C++_V | PRQA QA-C++_V | 4053||||||||||||
| Clang |
| -Wreorder | ||||||||||||
| CodeSonar |
| LANG.STRUCT.INIT.OOMI | Out of Order Member Initializers | |||||||||||
| Helix QAC |
| C++4053 | ||||||||||||
| Klocwork |
| CERT.OOP.CTOR.INIT_ORDER | ||||||||||||
| LDRA tool suite |
| 206 S | Fully implemented | |||||||||||
| Parasoft C/C++test |
| CERT_CPP-OOP53-a | List members in an initialization list in the order in which they are declared | |||||||||||
| Polyspace Bug Finder |
| CERT C++: OOP53-CPP | Checks for members not initialized in canonical order (rule fully covered) | |||||||||||
| RuleChecker |
| initializer-list-order | Fully checkedINIT-10 | |||||||||||
| SonarQube C/C++ Plugin |
| S3229 |
...