Controls the issuing of warnings for all implicit arithmetic conversions.
#pragma warn_implicitconv on | off | reset
If you enable this pragma, the compiler issues a warning for all implicit arithmetic conversions when the destination type might not represent the source value. Listing 10.40 provides an example.
#pragma warn_implicitconv on // required to enable warnings
#pragma warn_impl_f2i_conv on // enable conversion warning
#pragma warn_impl_i2f_conv on // enable conversion warning
#pragma warn_impl_s2u_conv on // enable conversion warning
float f;
signed int si;
unsigned int ui;
int main()
{
f = si; // WARNING
si = f; // WARNING
ui = si; // WARNING
si = ui; // WARNING
}
For more information about this warning, see “Implicit Arithmetic Conversions”.
NOTE This option “opens the gate” for the checking of implicit conversions. The sub-pragmas warn_impl_f2i_conv, warn_impl_i2f_conv, and warn_impl_s2u_conv control the classes of conversions checked.
This pragma corresponds to the Implicit Arithmetic Conversions setting . To check this setting, use __option (warn_implicitconv), described in Checking Settings. The default setting is off.