MISRA C:2023 Rule 8.13
Description
Rule Definition
A pointer should point to a const-qualified type whenever possible.
Rationale
This rule ensures that you do not inadvertently use pointers to modify objects.
Polyspace Implementation
The rule checker flags a pointer to a non-const
function parameter if the
pointer does not modify the addressed object. The assumption is that the pointer is
not meant to modify the object and so must point to a
const
-qualified type. Polyspace® does not raise a flag if the data pointed to by a
nonconst
pointer is modified by using a copy of the
pointer.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Declarations and Definitions |
Category: Advisory |
AGC Category: Advisory |
Version History
Introduced in R2024a