home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 18092 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  1.6 KB

  1. Path: sparky!uunet!mcsun!sunic!hagbard!loglule!jbn
  2. From: jbn@lulea.trab.se (Johan Bengtsson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Give me safe C++
  5. Message-ID: <5439@holden.lulea.trab.se>
  6. Date: 16 Dec 92 17:22:06 GMT
  7. References: <724462415snx@trmphrst.demon.co.uk>
  8. Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
  9. Lines: 30
  10. X-Newsreader: TIN [version 1.1 + PL8]
  11.  
  12. Nikki Locke (nikki@trmphrst.demon.co.uk) wrote:
  13. : How about a -safe-c++-only switch to the compiler :-)
  14.  
  15. What part of C++ is "safe" depends on the users.  Some users never
  16. make mistakes with pointers (I'm not one of them), while others
  17. would like to stay away from for example pointer arithmetic.
  18.  
  19. A project might have guidelines on these issues, like
  20.  
  21. "don't use virtual inheritance and/or MI"
  22. "don't use pointer arithmetic"
  23. "always check the result of new for NULL"
  24.  
  25. If a compiler supported a small script language for such usage constraints,
  26. then it would be easy to automatically check those things.  Violations
  27. should generate warnings.
  28.  
  29. Even a rather simple script language (perhaps #pragma based), that enables
  30. warning generation for the most commonly regarded "unsafe" features would
  31. IMHO be worth something.
  32.  
  33. I imagine it would not be excessively difficult to add such support
  34. in a compiler.
  35.  
  36. -- 
  37. --------------------------------------------------------------------------
  38. | Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
  39. | Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490  |
  40. --------------------------------------------------------------------------
  41.