Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC++2008-5-0-7

In this section:
Synopsis

(Required) There shall be no explicit floating-integral conversions of a cvalue expression.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

One or more explicit floating-integral conversions of a cvalue expression were found.

Coding standards

This check does not correspond to any coding standard rules.

Code examples

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

void f1 ( )
{
  int i;
  int j;
  float f;
  f = static_cast< float > ( i / j ); // Non-compliant
}

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

void f1 ( )
{
  int i;
  int j;
  int k;
  float f;
  k = i / j;
  f = static_cast< float > ( k ); // Compliant
}