Ignored Function Results

If you enable the pragma warn_resultnotused, the compiler issues a warning when it encounters a statement that calls a function without using its result. To prevent this warning, cast the statement with (void). See Listing 6.13 for an example.

Listing 6.13 Example of Pragma warn_resultnotused

#pragma warn_resultnotused on
void foo(int a,int b)
{
bar(); // warning: result of bar() is not used
(void)bar(); // void cast suppresses warning
}