Xref: utzoo comp.unix.sysv386:8398 comp.lang.c:39567 Newsgroups: comp.unix.sysv386,comp.lang.c Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!wuarchive!uunet!uunet!kithrup!sef From: sef@kithrup.COM (Sean Eric Fagan) Subject: Re: time(0L) - history of a misconception (was Re: SCO password generator) Organization: Kithrup Enterprises, Ltd. Date: Sat, 25 May 1991 00:27:06 GMT Message-ID: <1991May25.002706.27552@kithrup.COM> References: <381@tmcsys.UUCP> <1991May22.130713.25852@sco.COM> <1991May24.151350.22705@holos0.uucp> In article <1991May24.151350.22705@holos0.uucp> lbr@holos0.uucp (Len Reed) writes: >Under what architecture is a NULL pointer not "all bits 0"? Pr1me, Cyber 180, and another weird machine whose name I forget but might have been a Burroughs (excuse me, Unisys) machine. >NULL pointers *are* all zeros, though, since >casting zero to a pointer must yield a null pointer. That is a non-sequitor. Casting a constant 0 to a pointer must yeild a null pointer. Casting an integer, whose value is 0, to a pointer does not necessarily yield a null pointer. >(Maybe there's >a loophole here in ANSI that says that (void *)0 is a null pointer but >the compiler could implement that casted zero as somthing other than >a pattern of zeros. Not likely in the real world.) ANSI says exactly that. You should *never* assume that that things are otherwise. Talk to Henry, Doug, or Chris about such things; I'll just get into an argument and end up calling you a fool or worse. (HGoC might *think* so, but I don't think they'll *say* so. Well, actually, I'm not so sure about that, now that I think about it.) >You're certainly right that a NULL that produced a virtual memory fault >upon any use would be better than a virtual zero address. But it's not >the "compiler people" who would have to agree to this. Far too much >existing code would be broken by a move to this, I'm afraid. Many, many people have made address 0 result in an address fault (who said *anything* about virtual memory? lots of machines don't have virtual memory, and some of them still manage to compile C). Some people have made it work, simply to placate stupid programmer, such as you appear to be. Frankly, I would *much* rther have my OS complain, so I can track down the error (for that's what it is) during development. (SCO, for example, has address 0 readable and writable, because too many applications people bitched about it. I prefer having a core dump, myself.) -- Sean Eric Fagan | "I made the universe, but please don't blame me for it; sef@kithrup.COM | I had a bellyache at the time." -----------------+ -- The Turtle (Stephen King, _It_) Any opinions expressed are my own, and generally unpopular with others.