January 26, 2006

Lint traps bugs at compile time

Is your syntactically correct code not behaving? Lint is still a champ at detecting errors

The lint utility, which is shipped with some versions of Unix, traces its roots back to the days when compiling even modest programs took a long time. The utility was designed to check code for obvious errors and typos and remove them (as one would remove lint from clothing -- hence the name), so that an entire compilation cycle would not be wasted due to a spurious comma or semicolon.

As systems became faster, the cost of lost compilations decreased and developers used compilations as a way of performing syntax checking. In addition, compilers became better at identifying and warning about suspect constructions. Eventually, most developers stopped using lint and relied entirely on the compilers to do all checking. So much so that, several years ago, the GNU toolchain dropped lint entirely. Today, it does not ship on Linux platforms.

It's clear from the need for the tools in this review, that lint should have been improved rather than dropped. Fortunately, one great version of lint is still available today for all platforms. That is PC-Lint from Gimpel Software. The Unix version is called FlexeLint. At $239 per seat, PC-Lint is the best bargain in software development tools this side of open source. It catches just about every suspicious aspect possible. After you've configured it to fit your style, it delivers jewels.

For this review, I prepared a small C file with obvious bugs in it and asked each vendor to run it at the most sensitive bug-sniffing levels. Coverity, due to its detection philosophy, found zero; Klocwork found five. PC-Lint generated 15 warnings. Here, however, is the critical difference: Only PC-Lint correctly identified a miscoded function call. All vendors agreed this call could generate a null-pointer exception, which is a showstopper in C and C++ and a specific target of the reviewed suites.

Lint is particularly useful for locating a bug in code that compiles correctly -- syntactically correct code that does not behave as expected almost always has an error that lint will catch. What lint does not do is walk every possible execution path across a large code base to find cross-functional errors. However, if you're looking at static code analysis tools for the first time, start with PC-Lint.

Ultimately, if you use either Coverity Prevent or Klocwork K7, keep running lint on your code base. It will catch important details these tools and your compiler will miss.

Andrew Binstock is senior contributing editor of the InfoWorld Test Center.
Close

On Twitter now

Application development

Powered by Twitter

White Paper

D2D Virtual Tape Library Replication Primer

This whitepaper explains the terminology and concepts behind Data Replication technologies and establishes some sizing rules through worked examples. Learn the new paradigm in disaster tolerance—protect data anywhere.

Download now »

White Paper

An Alternative to Virtualization for Datacenter Cost Savings

Server virtualization is a popular option for dealing with mounting datacenter costs. Another equally promising approach is the use of an Application Delivery Controller. Citrix NetScaler provides a low-cost way for organizations to reduce their server count and accrue cost savings from a reduction in space, cooling, power and personnel.

Download now »

White Paper

Why Your Firewall, VPN, and IEEE 802.11i Aren't Enough to Protect Your Network

The emergence of WLANs has created a new breed of security threats to enterprise networks.

Included in HP ProCurve WLAN solutions is security technology that alleviates threats from WLANs through:
* Monitoring wireless activity inside and out of the enterprise
* Classifying WLAN transmissions into harmful and harmless
* Preventing transmissions that pose a security threat to the enterprise network
* Locating participating devices for physical remediation

Download now »

White Paper

Bringing the Edge to the Data Center

Effectively address data protection challenges, implementing solutions that help store and protect business–critical data while cutting costs and improving efficiency and reliability.

Download now »
caiwei 30-Nov-09 7:15pm
replica watches 2009 release for women is cheap swiss much more difficult, fake swiss because they are swiss watch replicas more delicate and fake swiss sensitive creatures that replica watches release appreciate uniqueness and cheap swiss individuality. For woman, luxury swiss watch is not cheap swiss just a thing replica watches 2009 release that shows time, replica watches first of all, cheap swiss it is jewelry. replica swiss Watch must meet swiss watch replicas a set of replica watches 2009 release criteria: beauty, fashion, replica swiss style, approach to luxury swiss evening dresses or replica watches release business attire, emphasize fake swiss its owner's elegance. luxury swiss Influence of fashion swiss made watches and personal desire f ugg sale for women is replica ugg boots sale much more difficult, cheap ugg sale because they are cheap ugg sale more delicate and ugg sale sensitive creatures that replica ugg boots appreciate uniqueness and cheap ugg sale individuality. For woman, replica ugg boots watch is not cheap ugg sale just a thing cheap ugg boots sale that shows time, replica ugg boots first of all, ugg sale it is jewelry. cheap ugg boots sale Watch must meet cheap ugg sale a set of cheap ugg boots sale criteria: beauty, fashion, cheap ugg sale style, approach to cheap ugg sale evening dresses or ugg sale business attire, emphasize ugg sale its owner's elegance. cheap ugg sale Influence of fashion ugg sale and personal desire f replica omega watches for women is replica omega watches much more difficult, omega watch because they are omega outlet more delicate and omega watch replica sensitive creatures that omega watch replica appreciate uniqueness and omega watches individuality. For woman, watch is not just a thing that shows time, first of all, it is jewelry. Watch must meet a set of criteria: beauty, fashion, style, approach to evening dresses or business attire, emphasize its owner's elegance. Influence of fashion and personal desire f

Sign up to receive InfoWorld Resource Alerts

Subscribe to the Developer World Newsletter

Receive a weekly roundup about the art and science of software development.

©1994-2009 Infoworld, Inc.