MISRA.CONV.FLOATImplicit floating-point conversion. MISRA-C++ Rule 5-0-5 (required): There shall be no implicit floating-integral conversions.[Undefined 4.9(1)] RationaleConversions from floating point to integral types discard information, and may lead to undefined behaviour if the floating-point value cannot be represented in the integral type. Conversions from integral types to floating point types may not result in an exact representation, which may not be consistent with developer expectations. Examplevoid f ( ) { float32_t f32; int32_t s32; s32 = f32; // Non-compliant f32 = s32; // Non-compliant f32 = static_cast< float32_t > ( s32 ); // Compliant } |