### warn_no_side_effect

Controls the issuing of warnings for redundant statements.

##### Syntax

#pragma warn_no_side_effect on | off | reset

##### Targets

All platforms.

##### Remarks

If you enable this pragma, the compiler issues a warning when it encounters a statement that produces no side effect. To suppress this warning, cast the statement with (void). Listing 10.43 provides an example

#### Listing 10.43 Example of Pragma warn_no_side_effect

#pragma warn_no_side_effect on
void foo(int a,int b)
{
a+b; // WARNING: expression has no side effect
(void)(a+b); // void cast suppresses warning
}

For more information about this warning, see “Redundant Statements”.

This pragma corresponds to the Expression Has No Side Effect panel setting . To check this setting, use __option (warn_no_side_effect), described in Checking Settings. The default setting is off.