|
Visual Lint
Integrated Lint Analysis for Microsoft Visual Studio and eMbedded Visual C++
|
 |
Introduction
Visual Lint is an add-in for Microsoft Visual C++ and Visual Studio
which closely integrates the Gimpel
PC-Lint static code analysis tool within the Visual Studio integrated
development environment.
|
A typical Visual Lint configuration running within Microsoft
Visual Studio 2005.
The
Analysis Status Display on the right shows
the progress of Lint background analysis, whilst the lint issues
within the current file are shown in a dedicated
Analysis Results Display docked at
the bottom of the main window.
|
A typical Visual Lint configuration
running within Microsoft Visual C++ 6.0.
The
Analysis Status Display on the right shows the progress of Lint background analysis,
whilst the lint issues within the current file are shown in a dedicated
Analysis Results Display
at the bottom of the main window.
|
Raw analysis results can also be made available in the Output Window.
The
Message Lookup Display (visible on the right) presents information on selected issues.
|
PC-Lint analyses C++ code to identify
potential problems. By comparison with a
C++ compiler such as that provided with
Visual C++, it is highly customisable
and very thorough, but
(understandably) significantly slower.
The output it produces is file based
and directed to the console by default,
for example:
--- Module: CJFlatHeaderCtrl.cpp
}
CJFlatHeaderCtrl.cpp(160): error 1401: (Warning -- member 'CCJFlatHeaderCtrl::m_bSortAsc'
(line 146, file ..\Include\CJFlatHeaderCtrl.h) not initialized by constructor)
}
CJFlatHeaderCtrl.cpp(166): error 1740: (Info -- pointer member'CCJFlatHeaderCtrl::m_pParentWnd'
(line 150, file ..\Include\CJFlatHeaderCtrl.h) not directly freed or zero'ed by destructor
-- Effective C++ #6)
--- Global Wrap-up
error 900: (Note -- Successful completion, 2 messages produced)
|
Although PC-Lint does a great job
of analysing C++ source and header
files for potential problems, it is
a generic cross-platform tool and as
such its integration with
development environments is limited.
For example, when used with Visual
C++ PC-Lint can be used (usually via
a custom command on the Tools menu)
to scan the current file for
warnings and direct the results to
the Output Window, or to scan a list
of files defined in a text file.
While this level of integration is
perfectly adequate under some scenarios
(for example when developing new
classes), it is less than ideal if you
want to perform a complete analysis of
an entire project or solution.
Furthermore, since PC-Lint does not
provide any means of generating useful
reports on the results it can be
difficult to spot potential problems
amongst the mass of results.
If you are working with a large
project these limitations can make using
PC-Lint to analyse your code time
consuming and difficult, which can
potentially this can be a real
disincentive to using this very useful
tool on a regular basis.
As a result, the quality of your code
could well suffer.
Introducing Visual Lint
Riverblade's
LintProject command line tool was of course
written with these issues in mind. However, even with
its assistance it is all too easy to put off dealing
with the warnings it generates because the sheer volume
can be overwhelming. This can be a particular issue when
PC-Lint is used to analyse an existing codebase for the
first time.
While static analysis results such as
those produced by LintProject are
useful, they are of limited use while
working on the code itself. In
particular, the developer's common
expectation of being able to double
click on a warning message to see the
code isn't available with such results,
and there is no way to prioritise
addressing the warnings identified.
Visual Lint is a Visual Studio
and Visual C++ add-in which aims to
overcome this by closely integrating the
Lint analysis process within the Visual
Studio integrated development
environment and making analysis results
available to the developer in a form
which is both useful and intuitive. This
makes it easier for developers to act on
the warnings identified – or (looking at
it another way) harder for them to
ignore them. Either way, one of the
common obstacles to making full use of
the analysis capability of PC-Lint is
removed.
One key issue which Visual Lint
addresses is speed. PC-Lint is
significantly slower than a C++
compiler (which is not surprising given
it’s thoroughness) and a complete
analysis of a large solution can take
literally hours. Whilst this is a
significant issue for a tool such as
LintProject, an add-in can take
advantage of the fact that a solution is
typically loaded within the development
environment for long periods of time -
during most of which it is sitting idle
with files open for editing (although
compilation is a computationally
intensive task, editing code is not!).
That time can of course be used -
with the judicious use of threading and
prioritisation - to perform background
analysis of the code. Better still, the
rich extensibility interface of Visual
Studio provides add-ins with the
opportunity to present information in a
familiar form which is closely
integrated with the environment.
LintProject and Visual Lint
are intended to complement each other.
While LintProject is a static analysis
tool suited to analysing a "snapshot" of
a solution (possibly as a validation
exercise) Visual Lint is designed
to assist developers directly while they work on the code.
Product Brief (PDF)
Pricing
Visual Lint Free Edition may be used at no cost.
For detailed pricing details for Visual Lint Standard and Professional Editions, please visit our
Online store.
Updates
If you wish to be kept informed of new releases and any relevant information, please consider joining
the LintProject/Visual Lint Mailing List.
We are continuing to develop Visual Lint further, and encourage you to contact us if
you would like to make suggestions about the features it should include or any other changes you would like to see.
|