Compartilhar via


PREfast Warning 216 (Windows CE 5.0)

Send Feedback

216 - Compiler-inserted cast between semantically different integer types.
Additional Information: Boolean to HRESULT.Note   For this warning, the SCODE type is equivalent to HRESULT.

This warning indicates that a Boolean is being used as an HRESULT without being explicitly cast.

This is likely to give undesirable results. For instance, the typical failure value for functions that return a Boolean (FALSE) is a success status when tested as an HRESULT.

Example

Defective Source

return SomeFunction();

Corrected Source

if (SomeFunction() == true) {
    return S_OK;
} else {
    return E_FAIL;
}

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.