Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!tektronix!zeus!tekla!dant From: dant@tekla.TEK.COM (Dan Tilque;1893;92-789;LP=A;60aC) Newsgroups: comp.lang.c Subject: Dereferencing zero Message-ID: <2953@zeus.TEK.COM> Date: 11 Jan 88 19:38:46 GMT References: <3306@ihlpf.ATT.COM> <7010@brl-smoke.ARPA> <1561@rtech.UUCP> Sender: news@zeus.TEK.COM Reply-To: dant@tekla.UUCP (Dan Tilque) Organization: Church of Christ, Secular Humanist Lines: 22 Jim Shankland writes: > > Code that dereferences 0 is buggy. If I >write such buggy code, I want to hear about it immediately by getting >an access violation when I do the dereference. I DON'T want my application >to continue running, possibly doing horrible things, because the language >implementor tried to do me a favor by covering up my bug. While *0 is bad and should be appropriately flagged, sometimes you need to reference a structure that begins at location zero. For example: struct system_vectors *svp; svp = 0; (svp->whatever_vector)(); Of course, this only works in supervisor mode on most machines, but sometimes you have to do it. --- Dan Tilque dant@tekla.tek.com or dant@tekla.UUCP