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

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!news.centerline.com!noc.near.net!inmet!spock!stt
  3. From: stt@spock.camb.inmet.com (Tucker Taft)
  4. Subject: Re: Language pitfalls (was Re: FORTRAN bug)
  5. Message-ID: <1992Dec15.203558.18211@inmet.camb.inmet.com>
  6. Sender: news@inmet.camb.inmet.com
  7. Nntp-Posting-Host: spock
  8. Organization: Intermetrics Inc, Cambridge MA
  9. References: <1992Dec15.135539.7245@lth.se> <EMERY.92Dec15095542@dr_no.mitre.org> <1992Dec15.180821.17817@beaver.cs.washington.edu>
  10. Date: Tue, 15 Dec 1992 20:35:58 GMT
  11. Lines: 33
  12.  
  13. In article <1992Dec15.180821.17817@beaver.cs.washington.edu> 
  14.   pattis@cs.washington.edu (Richard Pattis) writes:
  15.  
  16. > . . .
  17. >Often the base case of a recursive function to manipulate a list looks like:
  18. >
  19. >  IF mumble = NULL THEN
  20. >    RETURN NULL;
  21. >  ELSE ...
  22. >
  23. >What my students sometimes write is
  24. >
  25. >  IF mumble = NULL THEN
  26. >    NULL;
  27. >  ELSE ...
  28. >
  29. >Here the statement NULL replaces the returning of a NULL value (which might be
  30. >better to denote as NIL, at the expense of another reserved word). . . .
  31.  
  32. Oh boy.  That is a nasty one.  This argues for a "friendly" 
  33. Ada compiler giving a warning about any use of "null;" other
  34. than the idiomatic ones like "when others => null;" or "begin null; end;"
  35. (especially in a function that returns an access type ;-).
  36.  
  37. In retrospect, one could argue that it would have been better
  38. to have no "null" statement at all (other than simply ";") than
  39. to create a situation allowing this kind of one word error.
  40.  
  41. >Rich Pattis
  42.  
  43. S. Tucker Taft    stt@inmet.com
  44. Intermetrics, Inc.
  45. Cambridge, MA  02138
  46.