Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!amdcad!ames!mailrus!wasatch!utah-gr!uplherc!esunix!bpendlet From: bpendlet@esunix.UUCP (Bob Pendleton) Newsgroups: comp.arch Subject: Re: Software Distribution Message-ID: <993@esunix.UUCP> Date: 4 Oct 88 14:26:55 GMT References: <634@eiger.iis.UUCP> Organization: Evans & Sutherland, Salt Lake City, Utah Lines: 49 From article <634@eiger.iis.UUCP>, by prl@iis.UUCP (Peter Lamb): > In article <978@esunix.UUCP> bpendlet@esunix.UUCP (Bob Pendleton) writes: >> >>Try this scenario: >> >>So, the compiler that runs on brand X machines must, at least, put a >>flag in the UIF stating that dereferencing NULL is allowed. ... > > *HOW* are you going to manage this? Run time checks. How else do you check for illegal operations at run time? They can be implemented in hardware or software, I don't care which. > There is, as far as I can see no general solution to this problem. > I seem to remember that K&R say (roughly, I don't have it to hand) > that 0 does not correspond to *ANY* valid data. Run time checks aren't a general solution? They aren't even very expensive. At least not when compared to the alternative of buggy nonportable code. > Just *what* are you saying when you dereference NULL? Don't ask me, ask the language definition. If it isn't defined then you've found a flaw in the language definition. That applies to any language. If the language defines it (any feature), you have to implement so that it conforms to thae language specification. If the language leaves it undefined, then you have to deal with the fact that it will be used, and missued, in every possible way. I've used dialects of LISP in which (car NIL) was eq NIL and (cdr NIL) was eq NIL, and NIL, as a bit pattern, was not 0. Is it possible that you think I'm in favor of defining *NULL to be equal to NULL and are responding to that? I'm in favor of defining the behavior of every operator in a language on all of its operand set. Since NULL can be stored in a pointer, the actions of all pointer operators when applied to NULL should, in my opinion, be defined. > >>Bob Pendleton @ Evans & Sutherland > > > -- > Peter Lamb > uucp: seismo!mcvax!ethz!prl eunet: prl@ethz.uucp Tel: +411 256 5241 > Institute for Integrated Systems > ETH-Zentrum, 8092 Zurich