Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn) Newsgroups: net.lang.c Subject: Re: offsets in structures. Message-ID: <5400@brl-tgr.ARPA> Date: Fri, 19-Oct-84 16:19:34 EDT Article-I.D.: brl-tgr.5400 Posted: Fri Oct 19 16:19:34 1984 Date-Received: Mon, 22-Oct-84 15:27:29 EDT References: <393@orion.UUCP> <5172@brl-tgr.ARPA>, <6542@mordor.UUCP> Organization: Ballistic Research Lab Lines: 26 Although I see no particular use for the following piece of code, I believe that it is supposed to be legal both now and in the ANSI standard: char *foo; foo -= (long)foo; /* or (int) perhaps */ /* foo now is NULL */ More importantly, char *malloc(), *where; where = malloc( (unsigned)40 ); subr( where ); /* check validity of `where' and does something */ Here a NULL pointer must be type-compatible with other pointers. Using a special "nil" pointer could easily get in the way here (subr() might end up with special-case "nil"-handling in-line code every time its parameter is used). What more does using special "nil" get you than using a 0, apart from hardware check against dereferencing NULL? In any case, the hardware check is unnecessary if you write your code correctly. Are we all hackers or are there some professional programmers out there?