lint(1)lint(1)Namelint - check C code
Syntaxlint [Options] file...
The command detects features of the C program files which are likely to
be bugs, non-portable, or wasteful. It also checks the type usage of
the program more strictly than the compilers. Among the things which
are currently found are unreachable statements, loops not entered at
the top, automatic variables declared and not used, and logical expres‐
sions whose value is constant. Moreover, the usage of functions is
checked to find functions which return values in some places and not in
others, functions called with varying numbers of arguments, and func‐
tions whose values are not used.
By default, it is assumed that all the files are to be loaded together;
they are checked for mutual compatibility. Function definitions for
certain libraries are available to These libraries are referred to by a
conventional name, such as `-lm', in the style of Arguments ending in
.ln are also treated as library files.
To create libraries, use the -C option as follows:
lint-Cdlib files . . .
The C sources of library dlib are files. The result is the library
file llib-ldlib.ln in the correct library format suitable for linting
programs using dlib. Note that if you have set the System V environ‐
ment variable, the System V lint library is used. For further informa‐
Any number of the options in the following list may be used. The -D,
-U, and -I options of are also recognized as separate arguments.
-a Report assignments of long values to int variables.
-b Report break statements that cannot be reached. (This is not the
default because most and many outputs produce dozens of such com‐
-c Complain about casts that have questionable portability.
-h Apply a number of heuristic tests to attempt to find bugs, improve
style, and reduce waste.
-n Do not check compatibility against the standard library.
-p Attempt to check portability to the IBM and GCOS dialects of C.
-u Do not complain about functions and variables used and not
defined, or defined and not used. (This is suitable for running
on a subset of files out of a larger program.)
-v Suppress complaints about unused arguments in functions.
-x Report variables referred to be extern declarations, but never
Compile C programs for environment. If environment is SYSTEM_FIVE
or omitted, defines SYSTEM_FIVE for the preprocessor, and if the
loader is invoked, specifies that the System V version of the C
runtime library is used. Also, if the math library is specified
with the -lm option, the System V version is used. If environment
is POSIX, defines POSIX for the preprocessor. If the environment
variable PROG_ENV has the value SYSTEM_FIVE or POSIX, the effect
is the same as specifying the corresponding -Yenvironment option
to The -Y option overrides the PROG_ENV variable; -YBSD can be
used to override all special actions.
-z Do not complain about structures that are never defined (for exam‐
ple, using a structure pointer without knowing its contents.)
The system calls and other functions that do not return are not under‐
stood; this causes various anomalies in output.
Certain conventional comments in the C source change the behavior of
/*NOTREACHED*/ At appropriate points, stops comments about
/*VARARGSn*/ Suppresses the usual checking for variable numbers
of arguments in the following function declaration.
The data types of the first n arguments are
checked; a missing n is taken to be 0.
/*NOSTRICT*/ Shuts off strict type checking in the next expres‐
/*ARGSUSED*/ Turns on the -v option for the next function.
/*LINTLIBRARY*/ At the beginning of a file, shuts off complaints
about unused functions in this file.
Declarations for standard functions
Human readable version of above
System V declarations for standard functions
POSIX declarations for standard functions
Declarations for portable functions
Human readable . . .
Library created with -C
``Lint, a C Program Checker'', ULTRIX Supplementary Documents, Vol.