PREfast Warning 31 (Windows CE 5.0)
31 - Return value ignored.
Additional Information: <function> could fail.
This warning indicates that the calling function is not checking the return value of a function call that signals failure through its return value.
Depending on which function is being called, this defect can lead to seemingly random program misbehavior, including crashes and data corruptions in error conditions or low-resource situations.
In general, it is not safe to assume that a call to functions such as ReadFile (that is, one that accesses disk or network resources) or CoCreateInstance (that is, one that can require memory or other resources to be allocated) will always succeed.
The caller should always check the return value and handle error cases appropriately.
If you are intentionally ignoring the return value (for example, if you are taking advantage of a COM function's guarantee that it will initialize its outputs to NULL if it fails), you can silence PREfast by explicitly casting the return value to void.
Example
Defective Source
ImpersonateNamedPipeClient(Pipe);
Corrected Source
if (!ImpersonateNamedPipeClient(Pipe)) {
// Dangerous to continue
return;
Send Feedback on this topic to the authors