Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2012-Rule-11.6

In this section:
Synopsis

(Required) A cast shall not be performed between pointer to void and an arithmetic type.

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

A conversion between a pointer to void and an arithmetic type was found.

Coding standards
MISRA C:2012 Rule-11.6

(Required) A cast shall not be performed between pointer to void and an arithmetic type

Code examples

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

void example(void) {
  void * x;
  unsigned int y;
  x = (void *) 0x12345678;
  y = (unsigned int) x;
}

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

void example(void) {
  void * x;
  void * y;
  x = (void *) y;
}