MISRAC++2023-10.1.2 (C++ only)
In this section:
Synopsis
(Required) The volatile qualifier shall be used appropriately
Enabled by default
Yes
Severity/Certainty
High/High

Full description
Declaring local variables, parameters, return types, member functions or structured bindings can cause behaviour that is not well defined or well understood.
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
void example()
{
volatile int j; // Non-compliant
}
The following code example passes the check and will not give a warning about this issue:
volatile int j; // Compliant
void example()
{
}