warn_impl_f2i_conv

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

Syntax

#pragma warn_impl_f2i_conv on | off | reset

Targets
All platforms.
Remarks

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

Listing 10.37 Example of Implicit float-to-int Conversion

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

float f1, f2;
signed int si1, si2;

int main()
{
si1 = f1; // WARNING
#pragma warn_impl_f2i_conv off // disable conversion warning
si2 = f2; // OK
}

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

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