warn_impl_s2u_conv

Controls the issuing of warnings for implicit conversions between the signed int and unsigned int data types.

Syntax

#pragma warn_impl_s2u_conv on | off | reset

Targets
All platforms.
Remarks

If you enable this pragma, the compiler issues a warning for implicitly converting either from signed int to unsigned int or vice versa. Listing 10.39 provides an example.

Listing 10.39 Example of Implicit Conversions Between Signed int and unsigned int

#pragma warn_implicitconv on // required to enable warnings
#pragma warn_impl_s2u_conv on // enable conversion warningsigned int si;
unsigned int ui;

int main()
{
ui = si; // WARNING
si = ui; // WARNING

#pragma warn_impl_s2u_conv off // disable conversion warning
ui = si; // OK
si = ui; // OK
}

This pragma corresponds to the Signed / Unsigned setting . To check this setting, use __option (warn_impl_s2u_conv), described in Checking Settings. The default setting is off.

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