Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I download and install lint?

Tags:

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

like image 906
mcandre Avatar asked Jul 30 '11 05:07

mcandre


People also ask

What is the lint command?

Description. The lint command checks C and C++ language source code for coding and syntax errors and for inefficient or non-portable code. You can use this program to: Identify source code and library incompatibility. Enforce type-checking rules more strictly than does the compiler.


2 Answers

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

like image 130
Antti Avatar answered Oct 10 '22 17:10

Antti


From the splint FAQ:

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

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.

like image 24
gustafbstrom Avatar answered Oct 10 '22 17:10

gustafbstrom