ANSI C (re: null pointers)

Barry Shein bzs at bu-cs.BU.EDU
Sat Aug 23 02:24:49 AEST 1986


An amusing anecdote on NULL pointers:

On our large IBM system an early version of one of the screen editors
had a null pointer problem. Basically, it would load the contents of
address 0 into a register rather than a zero.

Of course, the contents of location zero was zero. Usually.

Address zero on an IBM is the Machine Check PSW double-word. This
will contain the PSW if a machine check recently occurred (PSW is
the combined processor status, program counter, machine check means
a detected hardware error, obviously not fatal or why put it there.)

You guessed it! Mysterious failures of the editor as address 0
contained non-zero values for fleeting microseconds after a machine
check, which was a rare event. I guess the area got re-zeroed after
the O/S logged the error (or whatever.) It handled the machine check
asynchronously (maybe this was really caused by the dual processors,
I don't remember.)

Fun fun. Kids, our lives were already ruined by this sort of self-abuse,
but you're young, you can be saved, ah youth, wasted on the young :-)

	-Barry Shein, Boston University



More information about the Comp.lang.c mailing list