Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC2004-11.1

In this section:
Synopsis

(Required) Conversions shall not be performed between a pointer to a function and any type other than an integral type.

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

Conversions were found between a pointer to a function and a type other than an integral type.

Coding standards
MISRA C:2004 11.1

(Required) Conversions shall not be performed between a pointer to a function and any type other than an integral type.

Code examples

The following code example fails the check and will give a warning:

#include <stdlib.h>

void example(void) {
  int (*fptr)(int,int);
  (int*)fptr;
}

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

#include <stdlib.h>

void example(void) {
  int (*fptr)(int,int);
  (int )fptr;
}