home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18561 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.4 KB  |  57 lines

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