感谢大家的解释,MSDN上如是说: Use of two sequential underscore characters ( __ ) at the beginning of an identifier, or a single leading underscore followed by a capital letter, is reserved for C++ implementations in all scopes. You should avoid using one leading underscore followed by a lowercase letter for names with file scope because of possible conflicts with current or future reserved identifiers.
感谢大家的解答,对于这个问题MSDN如是说: Use of two sequential underscore characters ( __ ) at the beginning of an identifier, or a single leading underscore followed by a capital letter, is reserved for C++ implementations in all scopes. You should avoid using one leading underscore followed by a lowercase letter for names with file scope because of possible conflicts with current or future reserved identifiers.
对特定的ANSI关键字来说只有一种格式, 即带双下划线__具体什么意思我也说不上来~~~~用到了就知道了~~~~不用着急~~~~呵呵~~~~~
C/C++的缺省调用协定,由调用者清理堆栈,这就是C/C++中可以使
用可变参数的函数的原因,所有参数自右至左入栈,生成的代码中
函数名有一个_(下划线)作前缀。
_stdcall (CALLBACK,WINAPI)
Win32 API的调用协定,由被调用的函数清理堆栈,所有参数自右至
左入栈,生成的代码中函数名有一个_(下划线)作前缀一个@和参数总
字节数(十进制)作後缀。它不支持可变参数,但它产生的代码比
_cdecl的短,因为没有每次调用後的清理堆栈的代码。
_fastcall
即快速调用协定,由被调用的函数清理堆栈,第一和第二个参数在ECX
和EDX中传递,其他参数自右至左入栈。生成的代码中函数名有一个@
和参数总字节数(十进制)作前缀。
thiscall
C++成员函数的缺省调用协定,不能用于显式函数说明,由被调用的函
数清理堆栈,所有参数自右至左入栈,this在ECX中传递,由于它不能
在C语言中使用,所以没有C的换名规则。 ifdef _MAC
#define CALLBACK PASCAL
#define WINAPI CDECL
#define WINAPIV CDECL
#define APIENTRY WINAPI
#define APIPRIVATE CDECL
#ifdef _68K_
#define PASCAL __pascal
#else
#define PASCAL
#endif
#elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#define CALLBACK __stdcall
#define WINAPI __stdcall
#define WINAPIV __cdecl
#define APIENTRY WINAPI
#define APIPRIVATE __stdcall
#define PASCAL __stdcall
#else
#define CALLBACK
#define WINAPI
#define WINAPIV
#define APIENTRY WINAPI
#define APIPRIVATE
#define PASCAL pascal
#endifVisual C++中,可以在函数类型前加_cdecl,_stdcall或者_pascal来表示其调用规范(默认为_cdecl)。
C++ Builder也支持_fastcall调用规范.
调用规范影响编译器产生的给定函数名,参数传递的顺序(从右到左或从左到右),
堆栈清理责任(调用者或者被调用者)以及参数传递机制(堆栈,CPU寄存器等)。将调用规范看成是函数类型的一部分是很重要的;不能用不兼容的调用规范将地址赋值给函数指针。例如:// 被调用函数是以int为参数,以int为返回值
__stdcall int callee(int); // 调用函数以函数指针为参数
void caller( __cdecl int(*ptr)(int)); // 在p中企图存储被调用函数地址的非法操作
__cdecl int(*p)(int) = callee; // 出错 指针p和callee()的类型不兼容,因为它们有不同的调用规范。
因此不能将被调用者的地址赋值给指针p,尽管两者有相同的返回值和参数列。
Use of two sequential underscore characters ( __ ) at the beginning of an identifier, or a single leading underscore followed by a capital letter, is reserved for C++ implementations in all scopes. You should avoid using one leading underscore followed by a lowercase letter for names with file scope because of possible conflicts with current or future reserved identifiers.
Use of two sequential underscore characters ( __ ) at the beginning of an identifier, or a single leading underscore followed by a capital letter, is reserved for C++ implementations in all scopes. You should avoid using one leading underscore followed by a lowercase letter for names with file scope because of possible conflicts with current or future reserved identifiers.
第一个回复的100分~~~