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

  1. Newsgroups: comp.lang.c++
  2. From: nikki@trmphrst.demon.co.uk (Nikki Locke)
  3. Path: sparky!uunet!pipex!demon!trmphrst.demon.co.uk!nikki
  4. Subject: Re: Give me safe C++
  5. Reply-To: nikki@trmphrst.demon.co.uk
  6. Distribution: world
  7. X-Mailer: cppnews $Revision: 1.30 $
  8. Organization: Trumphurst Ltd.
  9. Lines: 39
  10. Date: Tue, 15 Dec 1992 16:33:35 +0000
  11. Message-ID: <724462415snx@trmphrst.demon.co.uk>
  12. Sender: usenet@demon.co.uk
  13.  
  14. In article <1992Dec12.145403.26483@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  15. >     What makes virtual functions so useful is the fact that they
  16. > are so tightly restricted .. for example, unlike a genuine
  17. > function pointer they cannot be modified after object creation,
  18. > nor specialised on a per object basis.
  19. >     So when language designers propose restrictions, one must
  20. > carefully weigh up the pros and cons: most restrictions also
  21. > grant freedom. In the case of virtual functions, if your
  22. > program compiles and links they are sure to be properly initialised,
  23. > freeing you from checking this manually. 
  24.  
  25. This is a very good point. It is where something like Modula scores - you
  26. have very tight restrictions over what you can do, unless you specifically
  27. state you want to relax the restrictions for a particular module.
  28.  
  29. One of the drawbacks of C++ is that it is not always (often ?) clear 
  30. whether a particular line of code is doing something completely pure, or 
  31. is a nasty hack. My particular pet hate is the use of the same source code
  32. construct for casts and conversions, but there are many other examples.
  33.  
  34. I rather like the idea of a restricted subset of C++ which disallows 
  35. everything dubious, provided, of course, you can use the full power of the
  36. language occasionally (maybe in separate modules, or inside some #pragma 
  37. section). That way I get protected from my own mistakes, but I can still 
  38. work round any shortcomings in the language, the machine architecture or 
  39. the design.
  40.  
  41. This would also extend the appeal of C++ to a wider audience - I have seen
  42. many accounting (and similar) software writers reject C++ out of hand, 
  43. because they aren't happy with using a language where a single typing 
  44. mistake can re-write the operating system ! They are currently waiting
  45. for Object Oriented Cobol :-) 
  46.  
  47. How about a -safe-c++-only switch to the compiler :-)
  48.  
  49. -- 
  50. Nikki Locke,Trumphurst Ltd.(PC and Unix consultancy) nikki@trmphrst.demon.co.uk
  51. trmphrst.demon.co.uk is NOT affiliated with ANY other sites at demon.co.uk.
  52.