MISRA C++:2023 Rule 11.3.1
Description
Rule Definition
Variables of array type should not be declared.
Rationale
The size information of C-style array objects is not always preserved. It is safer to
use containers such as std::array
that preserve the size
information.
As an exception, declaring a const char
array is not a violation
if the array is immediately initialized with a string literal.
Polyspace Implementation
Polyspace® reports a violation of this rule if your code contains a C-style array. Polyspace does not report a violation of this rule when passing a traditional C-style array to a function because arrays decay to pointers when passed to a function as an argument.
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: Advisory |
Version History
Introduced in R2024b