Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2012-Rule-11.7

In this section:
Synopsis

(Required) A cast shall not be performed between pointer to object and a non-integer arithmetic type

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

A cast between a pointer to object and a non-integer arithmetic type was found. This check is identical to CERT-EXP39-C_e.

Coding standards
CERT EXP39-C

Do not access a variable through a pointer of an incompatible type

MISRA C:2012 Rule-11.7

(Required) A cast shall not be performed between pointer to object and a non-integer arithmetic type

Code examples

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

void example(void) {
  int *p;
  float f;
  f = (float)p;   /* Non-compliant */
}

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

void example(void) {
  int *p;
  short f;
  f = (short)p; 
}