Почему два указателя, указывающие на одну и ту же память, имеют разные эффекты в VA_START, один в порядке, но другой сбои?#include
#include
#include
void output_ok(int iIndex, const TCHAR* szFormat, ...)
{
TCHAR pBuf[256] = { 0 };
va_list pArgs;
va_start(pArgs, szFormat);
_vstprintf(pBuf, szFormat, pArgs);
va_end(pArgs);
}
void output_crash(int iIndex, const TCHAR* szFormat, ...)
{
const TCHAR* fmt = szFormat;
TCHAR pBuf[256] = { 0 };
va_list pArgs;
va_start(pArgs, fmt);
_vstprintf(pBuf, fmt, pArgs);
va_end(pArgs);
}
int main()
{
CString OpenGLVersion("4.6.0");
// output_ok(0, _T("OpenGL:%s"), OpenGLVersion);
output_crash(0, _T("OpenGL:%s"), OpenGLVersion);
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... tart-crash