[comp.lang.c] Lint recommendations

cweir@richsun.UUCP (Charles Weir) (10/20/89)

DETECTING BUGS
--------------

There are a number of common bugs which are easy to detect
mechanically.   Some examples which come to mind are:-

1) if (i=0) ...                                  /* = for == */
2) function() { char array[3]; return (array); } /* Invalid pointer
                                                    return */
3) function() { int i; if (i == 3) ... }         /* uninitialised
                                                    variable */

I know of two MSDOS - based lint programs which will find these (and
some 50 or so other) similar issues.   And I was appalled coming to
Unix (SunOs 4, in fact) to find that the standard lint will not do
that.

Does anyone know of Unix programs which will do the same job?

I consider this very important to increase programmer productivity.
And I will summarise any information received to the net.    Look for
"Summary: Lint Recommendations".

(Please don't start an argument about whether (1) is OK or not.   Yes,
I know it's a construction which is frequently used.   The point is
that here it isn't what the programmer intended.   Both the MSDOS lints
allow you to ignore specified types of errors.)


-- 
Charles Weir, Rich Inc, Franklin Park, IL 60131
Email: cweir@richsun.uucp  uunet!richsun!cweir

tneff@bfmny0.UU.NET (Tom Neff) (10/20/89)

What's really appalling is that Gimpel, makers of the best lint I've
seen, don't sell it hosted to Unix -- you have to buy shrouded source
for major $$.  They should build 386/ix and Xenix binaries and sell
them on cpio diskettes.
-- 
Annex Canada now!  We need the room,    \)      Tom Neff
    and who's going to stop us.         (\      tneff@bfmny0.UU.NET