类型检查 (CRT)Type Checking (CRT)

编译器对可采用可变数目的自变量的函数执行有限类型检查,如下所示:The compiler performs limited type checking on functions that can take a variable number of arguments, as follows:

函数调用 Function call 类型检查的参数Type-checked arguments
_cprintf_s, _cscanf_s, printf_s, scanf_s_cprintf_s, _cscanf_s, printf_s, scanf_s 第一个参数(格式字符串)First argument (format string)
fprintf_s, fscanf_s, sprintf_s, sscanf_sfprintf_s, fscanf_s, sprintf_s, sscanf_s 前两个自变量(文件或缓冲区和格式字符串)First two arguments (file or buffer and format string)
_snprintf_s 前三个自变量(文件或缓冲区、计数和格式字符串)First three arguments (file or buffer, count, and format string)
_open 前两个参数(路径和 _open 标志)First two arguments (path and _open flag)
_sopen_s 前三个参数(路径、_open 标志和共享模式)First three arguments (path, _open flag, and sharing mode)
_execl, _execle, _execlp, _execlpe_execl, _execle, _execlp, _execlpe 前两个参数(路径和第一个参数指针)First two arguments (path and first argument pointer)
_spawnl, _spawnle, _spawnlp, _spawnlpe_spawnl, _spawnle, _spawnlp, _spawnlpe 前三个参数(模式标志、路径和第一个参数指针)First three arguments (mode flag, path, and first argument pointer)

编译器会对这些函数的宽字符对等执行相同的有限类型检查。The compiler performs the same limited type checking on the wide-character counterparts of these functions.

请参阅See Also

CRT 库功能CRT Library Features