home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / ada / 3709 < prev    next >
Encoding:
Text File  |  1992-12-16  |  2.1 KB  |  40 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!asuvax!ennews!enuxha.eas.asu.edu!koehnema
  3. From: koehnema@enuxha.eas.asu.edu (Harry Koehnemann)
  4. Subject: Re: Language pitfalls (was Re: FORTRAN bug)
  5. Message-ID: <1992Dec16.163242.18923@ennews.eas.asu.edu>
  6. Followup-To: comp.lang.ada
  7. Sender: news@ennews.eas.asu.edu (USENET News System)
  8. Reply-To: koehnema@enuxha.eas.asu.edu (Harry Koehnemann)
  9. Organization: Arizona State University
  10. References: <1992Dec15.180821.17817@beaver.cs.washington.edu> <1992Dec15.203558.18211@inmet.camb.inmet.com> <EACHUS.92Dec15202249@oddjob.mitre.org>
  11. Date: Wed, 16 Dec 1992 16:32:42 GMT
  12. Lines: 26
  13.  
  14. In article <EACHUS.92Dec15202249@oddjob.mitre.org> eachus@oddjob.mitre.org (Robert I. Eachus) writes:
  15. >In article <1992Dec15.203558.18211@inmet.camb.inmet.com> stt@spock.camb.inmet.com (Tucker Taft) writes:
  16. >
  17. >   Oh boy.  That is a nasty one.  This argues for a "friendly" 
  18. >   Ada compiler giving a warning about any use of "null;" other
  19. >   than the idiomatic ones like "when others => null;" or "begin null; end;"
  20. >   (especially in a function that returns an access type ;-).
  21. >
  22. >    Actually, there is an Ada rule which normally catches this, and
  23. >which Robert Dewar and I have argued should be removed in Ada 9X.  (A
  24. >function must contain a return statement RM 6.5(1).)  If it belongs on
  25. >the top ten list, then the rule should stay.
  26.  
  27. The "null;"/"return null;" was a problem with the base case in a
  28. recursive function (null is overloaded, and even worse it's an
  29. expression *and* a statement - isn't that something we hate about
  30. C :).  This implies there will be additional returns somewhere in
  31. the routine and it will not be caught by the compiler.  The real
  32. problem is that there exists an execution path that can lead out
  33. of the function without encountering a return.  And, won't Ada
  34. catch this at run-time?  Granted it would be nice for the language
  35. to catch it at compile time, but the compiler could easily print a
  36. warning saying that such a path exists.
  37. --
  38. Harry Koehnemann            Arizona State University
  39. koehnema@enuxha.eas.asu.edu        Computer Science Department
  40.