Redundant Statements

If you enable the pragma warn_no_side_effect, the compiler issues a warning when it encounters a statement that produces no side effect. To prevent a statement with no side effects from signalling this warning, cast the statement with (void). See Listing 6.12 for an example.

Listing 6.12 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
}