[TUHS] reviving a bit of WWB

Paul Winalski paul.winalski at gmail.com
Tue Sep 22 04:40:10 AEST 2020


VAX/VMS was the first operating system I encountered where 0 was not a
valid program address.  As was mentioned previously, address space on
early machines was too precious to throw away a whole page of it just
to catch bad null pointer references.

I once saw a C program that depended on 0 being a valid pointer
address, and on a 0x00 byte being at memory address 0.  The program
had a bunch of char* pointers that were used in a printf() call,
something like:

printf("%s%s%s%s\n", a, b, c, d);

If you didn't want, say, the third string printed, you assigned NULL
to variable c.  That caused c to point to location 0, and printf()
interpreted the 0 byte as the empty string "".

It was hell getting this program to work on the VAX.

-Paul W.


More information about the TUHS mailing list