Detecting the use of HRESULT as bools

We have a large piece of code that has been reorganized in such a way that stuff that was just old C ++ is now COM.

I spent the last couple of days looking for places where we missed the fact that the function that previously returned boolnow returns HRESULT(the problem is that S_OK == false).

Is there a way to detect places in which it is HRESULTused as bool(and vice versa)?

We are using Visual Studio 2005 (VS8) Professional.

Is there anything other than @Steve's great offer that is not related to installing Team Edition?

+3
source share
1 answer

Are you using Code Analysis for C ++ ?

If so, you should see

C6214 for http://msdn.microsoft.com/en-us/library/yy6dx731.aspx

or

C6217 for http://msdn.microsoft.com/en-us/library/z5aa1ca1.aspx

Also check the source code ( # pragma ), and project settings do not disable these or other important warnings.

+3
source

Source: https://habr.com/ru/post/1768268/


All Articles