问题
In the Windows header file 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.
Thanks in advance.
Todd
回答1:
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.
来源:https://stackoverflow.com/questions/4176763/what-does-this-macro-do-successreturn-0-long