NULL pointer checking

Walter Bright bright at Data-IO.COM
Tue Feb 23 05:37:23 AEST 1988


In article <112 at westmark.UUCP> dave at westmark.UUCP (Dave Levenson) writes:
<MS-C release 3.0 and 4.0 also check for NULL pointer references at
<runtime.  They do this by loading a 16-byte constant (actually,
<their copyright notice) into the first sixteen bytes of the data
<segment.  This is checked against another copy before and after the
<execution of your program.  If they don't compare, the runtime
<package displays the nessage "NULL POINTER REFERENCE" as your
<program exits.  If you also managed to munge the operating system,
<however, this check probably won't save you!

This, of course, only works for NEAR pointers. Most of my programs use
FAR pointers (the default for C and L and H models). Assigning to
a far pointer with a NULL or small value results in stomping on the 8088's
interrupt vector table, necessitating a power off reset. This is nearly
always why the Ctrl-Alt-Del fails, it's because the keyboard interrupt
vector is gone!

P.S. I'll never understand why Intel didn't put the vector table at
FFF00, it would haved saved hundreds of programmers lots of grief.



More information about the Comp.lang.c mailing list