在Ipp 6.1的sample code - Audio-Video-Codecs的compile过程中发现有提示Error:
vm_file_win.c(1173): error C2198: 'vswprintf' : too few arguments for call
vswprintf是一个MACRO,通过查看vswprintf的定义可以发现,他VC安装目录里有不同的定义,分别是:
int __cdecl _vswprintf (
wchar_t *string,
const wchar_t *format,
va_list ap
);
int __cdecl vswprintf (
wchar_t *string,
size_t count,
const wchar_t *format,
va_list ap
);
他们的差别在于,后者多了一个参数 “size_t count”,表示buffer允许的最大长度。
在MSDN里有这样的解释:
In Visual C++ 2005, swprintf conforms to the ISO C Standard, which requires the second parameter, count, of type size_t. To force the old nonstandard behavior, define _CRT_NON_CONFORMING_SWPRINTFS. In a future version, the old behavior may be removed, so code should be changed to use the new conformant behavior.
所以,后者是为了兼容ISO C Standard,如果你需要使用MicroSoft 提供的较旧版本,需要增加宏定义:_CRT_NON_CONFORMING_SWPRINTFS