[英]What is the meaning of CDECL in this code?
here I have a code from the book programming windows fifth edition.在这里,我有一个来自编程 windows 第五版的代码。
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
int CDECL MessageBoxPrintf(TCHAR * szCaption, TCHAR * szFormat, ...)
{
TCHAR szBuffer[1024];
va_list pArgList;
// The va_start macro (defined in STDARG.H) is usually equivalent to:
// pArgList = (char *) &szFormat + sizeof (szFormat) ;
va_start(pArgList, szFormat);
// The last argument to wvsprintf points to the arguments
_vsntprintf(szBuffer, sizeof (szBuffer) / sizeof (TCHAR),
szFormat, pArgList);
// The va_end macro just zeroes out pArgList for no good reason
va_end(pArgList);
return MessageBox(NULL, szBuffer, szCaption, 0);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
int cxScreen, cyScreen;
cxScreen = GetSystemMetrics(SM_CXSCREEN);
cyScreen = GetSystemMetrics(SM_CYSCREEN);
MessageBoxPrintf(TEXT("ScrnSize"),
TEXT("The screen is %i pixels wide by %i pixels high."),
cxScreen, cyScreen);
return 0;
}
what is the meaning of CDECL after int in below code?下面代码中 int 之后的 CDECL 是什么意思?
int CDECL MessageBoxPrintf(TCHAR * szCaption, TCHAR * szFormat, ...)
In the windows header files, CDECL
is defined like this:在 windows 头文件中,
CDECL
是这样定义的:
#define CDECL
This seems a little odd.这似乎有点奇怪。 It is a macro that expands to nothing.
这是一个扩展为空的宏。 Used where a calling convention is expected it results in the default calling convention, namely
__cdecl
.在需要调用约定的地方使用它会导致默认调用约定,即
__cdecl
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.