negative addresses
Henry Spencer
henry at utzoo.uucp
Mon May 16 08:23:35 AEST 1988
> >Unfortunately, it is a real problem, because there are zillions of
> >programs that implicitly assume that pointers are all-zeros.
>
> I don't think this is true. How about an example?
Any program written by a programmer who believes the 4.3BSD manuals, or
any of their ancestors, all of which claim that the arg-list terminator
for execl is 0 rather than (char *)0. A pox on the Berkloids for not
having fixed this long ago!
I'm not intimately acquainted with the problem myself, but I do know that
at least one computer project that wanted to use a non-zero null pointer
studied the situation and decided to change the hardware instead.
>Not that much of a problem, really. The compiler knows about static
>data at compile time, and if not explicitly initialized it can output
>something like
> ptrname: .word 0xF0F0F0F0 ; null pointer pattern
>in the data section of the code it generates.
True, which is why I described it as "a bit of a pain" rather than as
a significant problem. The biggest nuisance, actually, is the loss in
effectiveness of the "BSS" optimization for object-module size.
--
NASA is to spaceflight as | Henry Spencer @ U of Toronto Zoology
the Post Office is to mail. | {ihnp4,decvax,uunet!mnetor}!utzoo!henry
More information about the Comp.lang.c
mailing list