Referencing NULL pointers
David Goodenough
dg at lakart.UUCP
Wed Jul 12 01:55:55 AEST 1989
>From article <19367 at paris.ics.uci.edu>, by hadley at ics.uci.edu (T.S. Hadley):
> By NULL pointer referencing I mean: consider the C frags:
>
> char *s = (char *) 0, t[10];
> strcpy(t, s);
>
> On my machine (sun) these statements causes segmentation violations
> during runtime.
>
> Apparantly, on other machines this is perfectly valid, since I see
> quite a lot of this in code created on certain non-sun machines.
Just remember one of the 10 commandments:
Thou shalt not follow the NULL pointer, for surely chaos and madness await
thee at it's end.
Your sun burps if you try it. Well good for it - I wish my CP/M box at home
would do so (however int i; i = *((int *) 1); does have it's uses :-) )
--
dg at lakart.UUCP - David Goodenough +---+
IHS | +-+-+
....... !harvard!xait!lakart!dg +-+-+ |
AKA: dg%lakart.uucp at xait.xerox.com +---+
More information about the Comp.unix.wizards
mailing list