[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Finding Ignored Function Results

When the warn_resultnotused is on, the compiler will issue 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.2 for an example.

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


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000