What does this macro do? __success(return >= 0) long
In the Windows header fil开发者_StackOverflow社区e WinNT.h, HRESULT is defines as follows:
typedef __success(return >= 0) long HRESULT;
Doing some research I learned that the "__success" macro is part of the Microsoft source code annotation language SAL and is defined in sal.h. But for the life of me I can't figure out what it does or how it does it.
This blog post on MSDN explains exactly what __success
means: it indicates that a function succeeded if it returns a HRESULT
value >= 0.
Annotations are just a way of describing something about a piece of code - by themselves, they don't "do" anything, but it's possible to have external tools verify the semantics of such annotations.
精彩评论