home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13438 < prev    next >
Encoding:
Text File  |  1992-09-09  |  2.5 KB  |  52 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!spool.mu.edu!darwin.sura.net!Sirius.dfn.de!ira.uka.de!slsvaat!josef!kanze
  3. From: kanze@us-es.sel.de (James Kanze)
  4. Subject: Re: GOTO, was: Tiny proposal for na
  5. In-Reply-To: ark@alice.att.com's message of 5 Sep 92 17:04:34 GMT
  6. Message-ID: <KANZE.92Sep9203633@slsvdnt.us-es.sel.de>
  7. Sender: news@us-es.sel.de
  8. Organization: SEL
  9. References: <714668024@thor> <6800007@tisdec.tis.tandy.com>
  10.     <1992Aug26.130335.26725@hemlock.cray.com> <1992Aug26.194538.1598@spss.com>
  11.     <rmartin.714931485@thor> <1992Aug27.181013.29933@spss.com>
  12.     <rmartin.715102882@thor> <1992Aug31.170908.13389@us-es.sel.de>
  13.     <23634@alice.att.com>
  14. Date: 9 Sep 92 20:36:33
  15. Lines: 35
  16.  
  17. In article <23634@alice.att.com> ark@alice.att.com (Andrew Koenig) writes:
  18.  
  19. > But since every program can be mechanically rewritten in that form,
  20. > it doesn't matter.  Moreover, if we do grant your premise, we might
  21. > argue that it is even easier to prove programs correct if we eliminate
  22. > iteration, which after all can always be expressed by recursion.
  23. > [Indeed, there is now a whole family of languages that do just that]
  24.  
  25. As you so well point out in the rest of your article, a proof is
  26. really just a convincing argument.  What we want is to be able to
  27. reason clearly about a piece of code.  This reasoning is simpler if
  28. the code conforms to the standards of structured programming.  The
  29. fact that the code could be mechanically rewritten to conform to these
  30. standards is academic if this doesn't actually take place.
  31.  
  32. The costs and benefits must be balanced.  The balance may be different
  33. according to the language and the application, but I would imagine
  34. that the additional simplicity in reasoning about the program would
  35. not make up for the loss of expressivity (in C/C++, at least) due to
  36. not using iteration.  In the same way, it is possible that in certain
  37. real time applications, the loss of performance due to not using goto
  38. may actually outway the added complexity of the code analysis.  In
  39. this case, I use a goto.  (Actually, if it gets this time critical, I
  40. usually drop back into assembler.:-).
  41.  
  42. Overall, however, my experience is that some sort of (generally
  43. informal) proof of correctness, based on the fundamental control flow
  44. structures, is very cost-efficient.  Generally speaking, it costs less
  45. to write a program correctly from the start, than to try and find out
  46. why it doesn't work later.
  47. --
  48. James Kanze                         GABI Software, Sarl.
  49. email: kanze@us-es.sel.de           8 rue du Faisan
  50.                                     67000 Strasbourg
  51.                                     France
  52.