warn_impl_i2f_conv

Controls the issuing of warnings for implicit int-to-float conversions.

Syntax

#pragma warn_impl_i2f_conv on | off | reset

Targets
All platforms.
Remarks

If you enable this pragma, the compiler issues a warning for implicitly converting integral values to floating-point values. Listing 10.38 provides an example.

Listing 10.38 Example of Implicit int-to-float Conversion

#pragma warn_implicitconv on // required to enable warnings
#pragma warn_impl_i2f_conv on // enable conversion warning

float f1, f2;
signed int si1, si2;

int main()
{
f1 = si1; // WARNING

#pragma warn_impl_i2f_conv off // disable conversion warning
f2 = si2; // OK
}

This pragma corresponds to the Integer to Float setting . To check this setting, use __option (warn_impl_i2f_conv), described in Checking Settings. The default setting is off.

NOTE The setting of this pragma is ignored unless warn_implicitconv is on.