Dereferencing NULL (was: *p++ = *p results?)

KW Heuer kwh at bentley.UUCP
Sat Apr 5 12:05:08 AEST 1986


In article <678 at bentley.UUCP> I wrote:
>On the 3b2, neither text or data space is anywhere near address zero,
>page zero has no interesting contents, yet it is readable.  Apparently
>this is so that programs that dereference NULL can be ported!  (I wish
>they'd at least make it a loader option, so it could be turned off...)

I've been informed by e-mail that there may be such a loader option (-z).
After much searching I found a manual in which it was documented.  The
acid test failed, though.  On my 3b2/300 running SVR2.0 (swapping), the
-z flag was silently ignored (the a.out files compared identical except
for timestamp).  Apparently this has been implemented in the paging
version.  (I still think it should be the default.)

Incidentally, *NULL bugs are especially elusive on a vax, since address
zero normally contains (short)0 (the entry mask for start).

Bonus question: Why does tabs.c call   strcmp(set_tab,"f(")   ?

Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint



More information about the Comp.lang.c mailing list