Skip to main content

IAR Embedded Workbench for Arm 9.70.x

RED-func-no-effect

In this section:
Synopsis

A function is declared that has no return type and creates no side effects.

Enabled by default

No

Severity/Certainty

Low/Low

lowlow.png
Full description

A function is declared that has no return type and creates no side effects. This function is meaningless. This check is identical to MISRAC++2008-0-1-8.

Coding standards
MISRA C++ 2008 0-1-8

(Required) All functions with void return type shall have external side effect(s).

Code examples

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

void pointless (int i, char c)
{
  int local;
  local = 0;
  local = i;
}

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

void func(int *i)
{
  int p;
  p = *i;
  int *ptr;
  ptr = i;
  *i = p;
  (*i)++;
}