Symbian
Symbian OS Library

FAQ-0449 Can I use Lint to static check EPOC code?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Debugging
Created: 12/07/99 Modified: 06/07/2001
Number: FAQ-0449
Platform: Not Applicable

Question:
Are there any better ways of finding bugs than just debugging and Visual C++ and G++ compiler warinings?

Answer:
Why Lint?
PC-Lint by Gimpel can find quite a number of bugs.

It's a compiler that merely produces error messages. But it's designed to much much better error messages than either of the two standard compilers. We esimate it adds at least 15% to debugging productivity, and removes more than a week from a typical 6 month project release schedule.

The attached option file tailors PC Lint for EPOC.

Most of the warnings will still be spurious -- they just suggest good places to check. We don't recommend spending the effort for existing code trying to get Lint to 'compile cleanly', although if you can manage it, it's a good target. Instead, run it at least once on all your code, when you think it's correct. Consider each error message very carefully - there's a good chance it's telling you of a bug.

Instructions to set up lint

Get a copy of PC Lint (from Gimpel or any compiler tool vendor), and install it into a suitable directory -- say c:\apps\lint.

Copy options.lnt and lin.bat (from this page) to the same directory and edit the file LIN.BAT accordingly.

Then in MSVC, select Tools - Customise - Tools. Enter the following two tools in the dialog box, setup as shown:

Correction: Except that the Initial Directory field should "$(FileDir)", not "$(CurDir)".

and

To run lint, just select a CPP file in your project and choose Tools - Lint current file, or Tools - Lint all cpp files in dir. This sends its output to the window below, where clicking on an error message brings up the file at the right line.

Known Problems

Some versions of Lint give errors for some of EPOC's stream operators. Just ignore them.