Referencing NULL pointers
Steven M. Bellovin
smb at ulysses.homer.nj.att.com
Mon Jul 10 19:05:45 AEST 1989
In article <19367 at paris.ics.uci.edu>, hadley at ics.uci.edu (T.S. Hadley) writes:
> By NULL pointer referencing I mean: consider the C frags:
> ...
> TYPE *t = (TYPE *) 0; /* typedef struct { ... } TYPE; */
> if(t->field == 0)
> ...
NULL pointer dereferencing (the correct term, btw) is illegal. That
it works on some machines is coincidental. I regard the segmentation
fault on the Suns as a useful feature of their implementation of
the system, as it catches bugs as shown above.
More information about the Comp.unix.wizards
mailing list