Main Content
MISRA C++:2023 Rule 8.2.6
An object with integral, enumerated, or pointer to void type shall not be cast to a pointer type
Since R2024b
Description
Rule Definition
An object with integral, enumerated, or pointer to void type shall not be cast to a pointer type.
Rationale
Casting void*
pointer, integral types, or enumerated types to an
object with pointer type results in unspecified behavior.
Polyspace Implementation
The checker allows an exception on zero constants, such as 0x0
,
0
, or 0U
.
Polyspace® does not report a violation if a void*
pointer is converted
to a pointer to 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: Expressions |
Category: Required |
Version History
Introduced in R2024b