在这段代码中(整个文件只包含一行):
char buffer[256] = { 0 };
用夹板检查,我得到以下提示:
foo.c(1,20): Initializer block for buffer has 1 element, but declared as char
[256]: 0
Initializer does not define all elements of a declared array. (Use
-initallelements to inhibit warning)
Initializer 没有定义声明数组的所有元素。这令人费解:我读了一些 SO 答案,但他们都声称{ 0 }
确实将所有元素初始化为零。
夹板版本:
Splint 3.1.1 --- 12 April 2003
Maintainer: splint-bug@splint.org
Compiled using Microsoft Visual C++ 6.0
从Splint.org下载。