C语言 如何下载和安装 lint?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6881269/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 09:15:59  来源:igfitidea点击:

How do I download and install lint?

cdebugginglintstatic-code-analysis

提问by mcandre

Does anyone know how to obtain lint for Mac, Windows, and Linux? sudo port install lintcan't find it.

有谁知道如何获取 Mac、Windows 和 Linux 的 lint?sudo port install lint找不到。

采纳答案by gustafbstrom

From the splint FAQ:

从夹板常见问题解答:

Splint supports most, but not all, of the C99 extensions to the ANSI C.

Splint 支持大多数(但不是全部)ANSI C 的 C99 扩展。

This implies that splint is alas not the same as lint. I've had personal experience with running splint on pieces of code like this:

这意味着夹板与皮棉不同。我有在这样的代码片段上运行夹板的个人经验:

for (int i; i < 100; i++)
    /* Run code */

As declaration of a variable inside the for loop header is not permitted until C99, like in this example, splint will complain about this. Hence, I'm still looking for a good alternative to splint for Ubuntu.

由于直到 C99 才允许在 for 循环标头中声明变量,就像在这个例子中一样,夹板会抱怨这个。因此,我仍在为 Ubuntu 寻找夹板的良好替代品。

回答by Antti

I've only seen lint for BSD. There's splint, however, a GPL lint rewrite, and it's available on most Linux distributions.

我只见过 BSD 的 lint。但是,有夹板,GPL lint 重写,并且在大多数 Linux 发行版上都可用。