[net.lang] nil dereferencing in Ada and C

macrakis@harvard.ARPA (Stavros Macrakis) (02/01/85)

> when CONSTRAINT_ERROR => ... 		--Jan Steinman, tektronix!tekecs!jans

Of course, Ada -detects- the nil pointer dereference (dynamically)
regardless of whether you have an exception handler.  Any reasonable Ada
system will do something useful if an exception is totally unhandled,
like print out the procedure call tree and perhaps the local
environment.

As for dynamic checking for C, a student here, Sam Kendall, spent last
year designing and writing a C compiler (bcc) which checks for nil
dereferencing, out-of-bounds array references, and other dynamic errors.
It operates by pre-processing the C.  Unlike a good Ada compiler,
though, it does no optimization or constraint propagation (so the
resulting code can be quite big and slow), and, of course, your code has
to avoid all the usual C type-punning.  He can be reached at
Kendall@Harvard.ARPA/UUCP phone 617-495-2258; the company he did this
for is Delft Consulting of NYC.

	-s