ATLASSERT vs ATLASSUME

ATL of Visual Studio 2005 contains a new interesting macro, undocumented though, which seems to provide a better hint for detecting bugs. Unlike documented ATLASSERT, ATLASSUME not only asserts on failure, but also makes an infinite loop with __analysis_assume intrinsic inside for the code analysis tool. However it is also important that this intrinsic does not affect any compilation optimization, for which an __assume is to be used.

It is also quite interesting to find other new macros ATLENSURE_THROW, ATLENSURE, ATLENSURE_SUCCEEDED and ATLENSURE_RETURN_HR, for which we had an analog since Visual C++ 6.0 and ATL3 (different shorter names though as they are very much convenient and widely used).

Categories: ATL

Leave a Reply