在公司设计案例上听一个朋友讲splint在强大的pc-lint面前只是一个小菜,可以方便地在linux上运行(pc-lint所说也行,有空试试),故想用来玩玩,
在FC9下载了splint-3.1.1.Linux.gz, 解压
./configure
make
make install
用网上一个朋友的用例
test.c
#include <stdio.h>
int main(int argc,char* argv[])
{
int a=100; /*没有使用的变量*/
int b[8];
printf("Hello c/n");
b[8]=100; /*明显数组越界 */
return 0;
}
splint test.c +bounds -paramuse -varuse
检查出了越界错误
还真不赖,小而好用