HRESULT Warnings (Windows Embedded CE 6.0)

1/5/2010

HRESULT is a return status type used by COM functions to signal success or failure.

There are strict guidelines for how HRESULT should be used. However, these are frequently overlooked or ignored. The Code Analysis tool detects situations where HRESULT has been used incorrectly or has been used in a manner that might cause undesirable results.

For more information about Code Analysis warnings, see this Microsoft Web site.

The following warnings are reported in this category:

Warning number Description

C6214

warning C6214: cast between semantically different integer types: HRESULT to a Boolean type

C6215

warning C6215: cast between semantically different integer types: a Boolean type to HRESULT

C6216

warning C6216: compiler-inserted cast between semantically different integral types: a Boolean type to HRESULT

C6217

warning C6217: Implicit cast between semantically different integer types: testing HRESULT with 'not'. Consider using SUCCEEDED or FAILED macro instead

C6219

warning C6219: Implicit cast between semantically different integer types: comparing HRESULT to 1 or TRUE. Consider using SUCCEEDED or FAILED macro instead

C6220

warning C6220 - Implicit cast between semantically different integer types: comparing HRESULT to -1. Consider using SUCCEEDED or FAILED macro instead

C6221

warning C6221: Implicit cast between semantically different integer types: comparing HRESULT to an integer. Consider using SUCCEEDED or FAILED macros instead

C6225

warning C6225: Implicit cast between semantically different integer types: assigning 1 or TRUE to HRESULT. Consider using S_FALSE instead

C6226

warning C6226: Implicit cast between semantically different integer types: assigning -1 to HRESULT. Consider using E_FAIL instead

C6230

warning C6230: implicit cast between semantically different integer types: using HRESULT in a Boolean context

See Also

Reference

Warnings by Category