<分区>
谁能简单解释一下。
C++ 中的 SAL_CALL 是什么?
<分区>
谁能简单解释一下。
C++ 中的 SAL_CALL 是什么?
最佳答案
它是 OpenOffice.org 中使用的 #define
。它在 sal/inc/sal/types.h
中定义为以下之一:
#define SAL_CALL
#define SAL_CALL __cdecl
取决于正在编译的平台。看起来只有在定义了 _MSC_VER
(对于 Microsoft)时才设置为后者。
它在指定函数时使用,例如:
virtual void SAL_CALL acquire() throw () { ++m_nRefCount; }
这将变成:
virtual void acquire() throw () { ++m_nRefCount; }
对于常规编译器和:
virtual void __cdecl acquire() throw () { ++m_nRefCount; }
对于微软。
关于 __cdecl
对 Microsoft 编译器的意义,参见 here , 摘录如下:
微软特定
这是 C 和 C++ 程序的默认调用约定。因为调用者清理了堆栈,所以它可以执行 vararg
函数。 __cdecl
调用约定创建比 __stdcall
更大的可执行文件,因为它要求每个函数调用都包含堆栈清理代码。以下列表显示了此调用约定的实现。
+------------------------+----------------------------+
| Element | Implementation |
+------------------------+----------------------------+
| Argument-passing order | Right to left |
+------------------------+----------------------------+
| Stack-maintenance | Calling function pops the |
| responsibility | arguments from the stack |
+------------------------+----------------------------+
| Name-decoration | Underscore character (_) |
| convention | is prefixed to names |
+------------------------+----------------------------+
| Case-translation | No case translation |
| convention | performed |
+------------------------+----------------------------+
关于c++ - C++ 中的 SAL_CALL 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5101182/