Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC2012-Rule-22.5_a

In this section:
Synopsis

(Mandatory) A pointer to a FILE object shall not be dereferenced

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

A pointer to a FILE object is dereferenced. This check is identical to RESOURCE-deref-file.

Coding standards
MISRA C:2012 Rule-22.5

(Mandatory) A pointer to a FILE object shall not be dereferenced

Code examples

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

#include <stdio.h>

void example(void) {
   FILE *f1;
   FILE *f2;
   *f2 = *f1;
}

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

#include <stdio.h>

void example(void) {
  FILE *f1;
  FILE *f2;

  f1 = f2;
}