Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!houxm!vax135!ariel!hou5f!hou5e!hou5d!hogpc!houxe!drutx!ihnp4!zehntel!dual!amd!decwrl!decvax!linus!philabs!cmcl2!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.UUCP Newsgroups: net.lang.c Subject: Re: offsets in structures. Message-ID: <5400@brl-tgr.UUCP> 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: Tue, 23-Oct-84 05:08:02 EDT References: <393@orion.UUCP> <5172@brl-tgr.ARPA>, <6542@mordor.UUCP> <5272@brl-tgr.ARPA>, <196@rlgvax.UUCP> <5319@brl-tgr.ARPA> Lines: 35 Relay-Version: version B 2.10 5/3/83; site houxe.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Message-ID: <5400@brl-tgr.ARPA> Date: Fri, 19-Oct-84 16:19:34 EDT <204@rlgvax.Fri, 19-Oct-84 13:19:34 PDT 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?