MISRA C++:2023 Rule 11.6.2
Description
Rule Definition
The value of an object must not be read before it has been set.
Rationale
The C++ standard does not specify what the value of an uninitialized memory can be. This value is unpredictable and can be different every time the program runs. Reading and using the value of an uninitialized memory results in unexpected behavior.
Polyspace Implementation
Polyspace® reports a violation of this rule if your code contains these issues:
Non-initialized variable: A variable is read before initialization.
Non-initialized member: A class member is not initialized in the class constructor:
Non-initialized pointer: A pointer is dereferenced before initialization.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Declarators |
Category: Mandatory |
Version History
Introduced in R2024b