What does this macro do? __success(return >= 0) long

倖福魔咒の 提交于 2019-12-13 14:43:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!