Great stuff - particularly the info on CodeWizard since it's apparently not
quite what I'm looking for ... at this time anyway. Glad I asked. :)

Looks like I'll grab a copy of PC-Lint and give it a whirl and see how it
goes.


For those curious, I discovered a "flaw" in one of my class definitions:
(paraphrased)

        class xBase {
        public:
                int thing;
                xBase(void) { thing = 55; };
                xBase(int iv) { thing = iv; };
        };
        class xExtend : public xBase {
        public:
                int stuff;
                int thing;
                xExtend(int sv, int iv) { stuff = sv; thing = iv; };
        };
        // ...
        xExtend *test = new xExtend(1,2);

Technically, this is a legal construct - repetition of the member 'thing'.
Each 'thing' is retained as a separate member and the value obtained depends
the object being dereferenced (xExtend widget.thing --> 2 versus xBase
blob.thing --> 55).

There are probably legitimate uses for this feature but, off hand, I'm not
seeing one other than CPA ("Convenient Problem Avoidance") during class
inheritance ... which is probably significant on a larger scale code base.
Hmmm, even that reasoning doesn't make solid sense to me either ...

Anyway, the compiler (MSVC6) seemed happy enough although I feel it should
warn about such things and require the programmer to at least be aware of
the situation if not otherwise address a possible conflict.

The programmer confusion alone, however, justifies a trivial rename of one
of the members. Actually, in the case in question, 'thing' wasn't necessary
in the superclass anyway since it denoted a property of the subclass.

On the other hand, it made me wish I had a lint program designed to work
with the mystical magical fun of C++ which might detect this potential
problem as well as a slew of others I've probably got scattered among my
code.

Well, long winded explanation aside, thanks again for the feedback.
Ry




> -----Original Message-----
> From: Thomas Wicklund [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 15, 2002 8:53 PM
> To: [EMAIL PROTECTED]
> Subject: C++ analysis tools ...?
> 
> 
> I can't help with free tools, but I've used and evaluated several
> static analysis tools over the years.
> 
> Codewizard seems more a coding standards checker than a lint tool.  It
> has features to check that names follow various rules for
> capitalization, etc. but seemed to have little in checking the code
> itself, at least reviewing the list of messages generated.
> 
> FlexeLint / PC-Lint is an excellent product with generally excellent
> support, well worth the money.  The flow analysis generates a lot of
> extraneous messages, though they are divided into 3 levels of
> severity.  It's very good at finding problems with operator precedence
> or macro oddities.  I last used FlexeLint on a 1 million+ line of code
> product, finding a number of bugs (this is a very extensively tested
> product).  My experience is with C code, but what I've seen of the C++
> portion looks good.
> 
> For completeness, I'm also aware of a service called InstantQA
> (www.reasoning.com), it may be C only.  Obviously not in your price
> range.  I've seen reports from real code they checked.  What I saw was
> very impressive, finding some fairly obscure pointer problems.  As a
> service I don't know how they do it, they could have some very
> sophisticated analysis tools or they may run the code through a
> typical lint tool and manually identify the real problems.
> 
> Thomas Wicklund
> 
> 
> Ryan Mapes writes:
>  > Hiya,
>  > 
>  > Does anyone know of a good 'lint' for use with C++ code?
>  > (OS: Windows 2000)
>  > 
>  > Does SPLint already support C++ code analysis? If so, 
> please let me know
>  > since I'm not seeing how to set it up. Although, on a 
> per-file basis I have
>  > been mildly successful with 'C' related stuff but class 
> inheritance and
>  > overloaded functions cause all sorts of warnings (beyond 
> the "normal"
>  > warnings:).
>  > 
>  > Meanwhile, I'm aware of a couple of commercial packages:
>  > - Parasoft's' CodeWizard (~$1000)
>  > - Gimpel Software's FlexeLint and PC-Lint for C/C++ (~$250)
> 

Reply via email to