Main Content

MISRA C++:2023 Rule 8.3.1

The built-in unary - operator should not be applied to an expression of unsigned type

Since R2024b

Description

Rule Definition

The built-in unary - operator should not be applied to an expression of unsigned type.

Polyspace Implementation

Polyspace® flags a casting operation if it converts a pointer type variable to an integral type variable.

Troubleshooting

If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.

Check Information

Group: Expressions
Category: Advisory

Version History

Introduced in R2024b