Path: utzoo!mnetor!uunet!husc6!purdue!gatech!hubcap!grimlok From: grimlok@hubcap.UUCP (Mike Percy) Newsgroups: comp.lang.c Subject: Re: Referencing through a null pointer Message-ID: <1495@hubcap.UUCP> Date: 25 Apr 88 18:40:23 GMT References: <4729@cup.portal.com> Distribution: na Organization: Clemson University, Clemson, SC Lines: 35 From article <4729@cup.portal.com>, by Paul_L_Schauble@cup.portal.com: > Could someone please tell me which machine it was that started the > unfortunate convention that referencing through the null pointer returns a > zero with no error? I was under the impression it was BSD Unix, but I'm not > sure. > > Thanks, > Paul Well, I don't know bout this, but I do know that at least some compilers try to give some sort of indication that you have reda or written through a null pointer. For instance, when I use TurboC and do this: printf("%s",some_char_star_pointer); I get (null) which is real nice. Only good for strings though, but it is also useful, but not quite so obviously, that on termination, it seems that TC also checks the values at &(NULL) and if what is there is not what should be there you get the message (null pointer reference) (that is, if your program manages to terminate "properly") Note that I have not gotten elbow deep verifying exactly how TC implements this, but it seems simple enough to me. volatile --- yeaah! noalias --- ppppppphbbblllaaatthhh