AUTOSAR C++14 Rule M4-10-1
NULL shall not be used as an integer value
Description
Rule Definition
NULL shall not be used as an integer value.
Rationale
In C++, you can use the literals 0 and NULL as both an integer and a null pointer constant. However, use of 0 as a null pointer constant or NULL as an integer can cause developer confusion.
This rule restricts the use of NULL to null pointer constants. AUTOSAR C++14 Rule M4-10-2
restricts the use of the literal 0 to integers.
Polyspace Implementation
The checker flags assignment of NULL to an integer variable or binary operations involving NULL and an integer. Assignments can be direct or indirect such as passing NULL as integer argument to a function.
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: Standard Conversions |
Category: Required, Automated |
Version History
Introduced in R2019a