We have a big 开发者_StackOverflow社区body of code that was refactored so that stuff which was plain-old C++ is now COM.
I've been spending the last couple of days hunting out places in which we missed the fact that a function that previously returned a bool
now returns an HRESULT
(the problem is compound by the fact that S_OK == false
).
Is there a way to detect places in which an HRESULT
is being used as a bool
(and vice versa)?
We're using Visual Studio 2005 (VS8) Professional.
Is there anything other than @Steve's excellent suggestion which doesn't involve installing Team Edition?
Are you using Code Analysis for C++?
If so, you should see
C6214 per http://msdn.microsoft.com/en-us/library/yy6dx731.aspx
or
C6217 per http://msdn.microsoft.com/en-us/library/z5aa1ca1.aspx
Also verify your source code (via #pragma) and project options do not disable these or other important warnings.
精彩评论