LinuxCommandLibrary

lint

TLDR

Check C program

$ lint [program.c]
copy
Check with library
$ lint -l[library] [program.c]
copy
Suppress specific warnings
$ lint -e[code] [program.c]
copy
Portable mode
$ lint -p [program.c]
copy

SYNOPSIS

lint [options] files...

DESCRIPTION

lint is a classic static analysis tool for C programs. It checks source code for potential bugs, stylistic errors, and suspicious constructs that are syntactically valid but likely incorrect.
lint performs deeper analysis than the compiler, catching type mismatches, unused variables, and problematic patterns.

PARAMETERS

-a

Report assignments in conditionals.
-b
Report break statements.
-c
Produce .ln files.
-e code
Suppress error code.
-l lib
Include lint library.
-p
Portable C checking.
-v
Verbose output.

COMMON CHECKS

$ - Type consistency
- Unused variables
- Unreachable code
- Format string issues
- Missing return values
copy

CAVEATS

Original lint largely replaced by compiler warnings and modern tools like clang-tidy, cppcheck. Traditional lint may not be available on all systems.

HISTORY

lint was written by Stephen C. Johnson at Bell Labs in 1978. The name comes from the lint (fluff) it picks from programs. It pioneered static analysis tools.

SEE ALSO

splint(1), cppcheck(1), clang-tidy(1), gcc(1)

Copied to clipboard