Access Keys:
Skip to content (Access Key - 0)

Using Lint to clean up your code

If your code compiles, but doesn't run as well as you expected, try using "lint" to help you clean up your code. Lint, according to its manual page:

Lint attempts to detect features of the C program files which are
likely to be bugs, or 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 expressions 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 functions whose values are not used or whose values
are used but none returned.

To use lint, type:

joeuser@athena:~$ add sunsoft; lint file.c

Note: Be sure to fill in the correct information for file.c.

Many of the things lint warns about can also be found by using the -pedantic option to gcc.

IS&T Contributions

Documentation and information provided by IS&T staff members

Last Modified:

March 10, 2012

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
olc-c olc-c Delete
lint lint Delete
code code Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
This product/service is:
Easy to use
Difficult to use

This article is:
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki