Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC++2008-3-9-3

In this section:
Synopsis

(Required) The underlying bit representations of floating-point values shall not be used.

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

An expression provides access to the bit-representation of a floating-point variable. This check is identical to MISRAC2004-12.12_b.

Coding standards
MISRA C:2004 12.12

(Required) The underlying bit representations of floating-point values shall not be used.

Code examples

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

void example(float f) {
	int * x = (int *)&f;
	int i = *x;
}

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

void example(float f) {
	int i = (int)f;
}