我知道splint会发出有关C程序中问题的警告信息。
我使用'sudo apt-get install splint'将它安装在我的Ubuntu上。
如何在C程序或程序中使用它?
答案 0 :(得分:1)
如果您在名为test.c
的文件中创建以下C程序,则可以使用splint
对源执行静态分析以查找可能的问题。
放入test.c文件的源代码:
#include <stdio.h>
int main(int argc, char *argv[])
{
int a = 100;
int b[8];
printf("Hello c\n");
b[8] = 100; // error
return 0;
}
用于针对C源文件运行splint
以检查问题的命令行。
$ splint test.c +bounds -paramuse -varuse