问题描述
在Windows头文件WinNT.h中,HRESULT定义如下:
In the Windows header file WinNT.h, HRESULT is defines as follows:
typedef __success(return >= 0) long HRESULT;
做了一些研究,我了解到__success"宏是 Microsoft 源代码注释语言 SAL 的一部分,并在 sal.h 中定义.但对于我的生活,我无法弄清楚它做了什么或它是如何做的.
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.
推荐答案
MSDN 上的这篇博文 准确地解释了 __success
的含义:它表示一个函数如果返回 HRESULT
值 >= 0,则成功.
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.
这篇关于这个宏有什么作用?__success(return >= 0) long的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!