Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC++2023-7.11.3 (C++ only)

In this section:
Synopsis

(Required) A conversion from function type to pointer-to-function type shall only occur in appropriate contexts

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

Found inappropriate conversion from function type to pointer-to-function type

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:

extern int* f();

bool example() {
  return (f == nullptr);  // Non-compliant
}

The following code example passes the check and will not give a warning about this issue:

extern int* f();

bool example() {
  return (&f == nullptr);  // Compliant
}