home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsk!pegasus!hansen
- From: hansen@pegasus.att.com (Tony L. Hansen)
- Subject: Re: Is there a lint++?
- Organization: AT&T
- Date: Wed, 30 Dec 1992 21:28:08 GMT
- Message-ID: <1992Dec30.212808.15582@cbnewsk.cb.att.com>
- Summary: yes, there are some things a lint++ can do
- Keywords: c++, lint
- References: <BzF61B.291@ucunix.san.uc.edu> <1gs98eINN7ba@rs6000.bham.ac.uk>
- Sender: hansen@cbnewsk.cb.att.com (tony.l.hansen)
- Lines: 43
-
- From: pickerig@eee.bham.ac.uk (Guy Pickering)
-
- << This may seem peculiar, but is there such a thing as lint++ to check C++
- << code? Or does lint have a switch to do the same?
-
- < lint is a tool to highlight problems in C code. It was designed to
- < suppliment pre-ANSI C compilers, because they would quite happily pass bad
- < code (mainly in the area of parameter mis-matches).
-
- < Your C++ compiler should not need lint. lint (as far as I know) offers
- < nothing your C++ compiler will provide. Anything that is not caught at
- < compile time will be caught at link time bacause of type safe linkage.
-
- There are a number of things which a lint++ could check for. Some of these
- are C++-specific and others are shared with C.
-
- Scott Meyers (author of Effective C++) wrote a paper that appeared in the
- UseNIX C++ Conference a year or so ago that talked about several things that
- are C++-specific. An example would be checking to make certain that a class
- which has virtual functions also has a virtual destructor.
-
- There are also various things which lint checks in C that would be useful in
- C++. These are things which require extra-lingual information that lint
- pragma's can provide information on. An example is checking the types of
- parameters of variable-length argument functions (such as sprintf() and
- execl()). C++ has no way of specifying information on what's supposed to be
- provided in the "..." portion of the function invocation.
-
- Take a look at a modern lint, such as the UNIX System V Release 4 lint, and
- look at the types of things checked for and the pragmas that are supported.
- Not all of these capabilities are associated with the type system.
-
- Here's another example:
-
- function/variable X is external and could be static
-
- There's no way that a C++ compiler is going to tell you that information,
- but the SVR4 lint will.
-
- Tony Hansen
- hansen@pegasus.att.com, tony@attmail.com
- att!pegasus!hansen, attmail!tony
-
-