time(0L) - history of a misconception (was Re: SCO password generator)
Sean Eric Fagan
sef at kithrup.COM
Sat May 25 10:27:06 AEST 1991
In article <1991May24.151350.22705 at holos0.uucp> lbr at 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 at 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.
More information about the Comp.unix.sysv386
mailing list