home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!news.centerline.com!noc.near.net!inmet!spock!stt
- From: stt@spock.camb.inmet.com (Tucker Taft)
- Subject: Re: Language pitfalls (was Re: FORTRAN bug)
- Message-ID: <1992Dec15.203558.18211@inmet.camb.inmet.com>
- Sender: news@inmet.camb.inmet.com
- Nntp-Posting-Host: spock
- Organization: Intermetrics Inc, Cambridge MA
- References: <1992Dec15.135539.7245@lth.se> <EMERY.92Dec15095542@dr_no.mitre.org> <1992Dec15.180821.17817@beaver.cs.washington.edu>
- Date: Tue, 15 Dec 1992 20:35:58 GMT
- Lines: 33
-
- In article <1992Dec15.180821.17817@beaver.cs.washington.edu>
- pattis@cs.washington.edu (Richard Pattis) writes:
-
- > . . .
- >Often the base case of a recursive function to manipulate a list looks like:
- >
- > IF mumble = NULL THEN
- > RETURN NULL;
- > ELSE ...
- >
- >What my students sometimes write is
- >
- > IF mumble = NULL THEN
- > NULL;
- > ELSE ...
- >
- >Here the statement NULL replaces the returning of a NULL value (which might be
- >better to denote as NIL, at the expense of another reserved word). . . .
-
- Oh boy. That is a nasty one. This argues for a "friendly"
- Ada compiler giving a warning about any use of "null;" other
- than the idiomatic ones like "when others => null;" or "begin null; end;"
- (especially in a function that returns an access type ;-).
-
- In retrospect, one could argue that it would have been better
- to have no "null" statement at all (other than simply ";") than
- to create a situation allowing this kind of one word error.
-
- >Rich Pattis
-
- S. Tucker Taft stt@inmet.com
- Intermetrics, Inc.
- Cambridge, MA 02138
-