我知道夹板是发出有关 C 程序问题的警告消息。
我使用“sudo apt-get install splint”将它安装在我的 Ubuntu 上。
如何在一个或多个 C 程序上使用它?
如果您在名为的文件中创建以下 C 程序,test.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;
}
用于splint
针对 C 源文件运行以检查问题的命令行。
$ splint test.c +bounds -paramuse -varuse