MISRAC++2023-8.3.2
In this section:
Synopsis
(Advisory) The built-in unary + operator should not be used
Enabled by default
No
Severity/Certainty
Low/Medium

Full description
Unary + promotes to int or cause a lambda to decay to function pointer. Use static_cast instead.
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
int example(unsigned short n) {
return +n; // Non-compliant - triggers promotion to int
}
The following code example passes the check and will not give a warning about this issue:
int example(unsigned short n) {
return static_cast<int>(n); // Compliant
}