这个宏有什么作用? __success(return> = 0)长 [英] What does this macro do? __success(return >= 0) long
问题描述
在Windows头文件WinNT.h中,HRESULT的定义如下:
In the Windows header file WinNT.h, HRESULT is defines as follows:
typedef __success(return >= 0) long HRESULT;
进行一些研究后,我发现"__成功"宏是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.
推荐答案
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)长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!