Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!camelback!volpe From: volpe@camelback.crd.ge.com (Christopher R Volpe) Newsgroups: comp.lang.c Subject: Re: NULL question not in FAQ Message-ID: <18147@crdgw1.crd.ge.com> Date: 2 Apr 91 14:53:08 GMT References: <1991Mar26.235643.4498@ux1.cso.uiuc.edu> <1991Mar27.194101.1685@grebyn.com> <1103@gtenmc.UUCP> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@camelback.crd.ge.com (Christopher R Volpe) Lines: 28 In article <1103@gtenmc.UUCP>, ravim@gtenmc.UUCP (Vox Populi) writes: |>In article <1991Mar27.194101.1685@grebyn.com> ckp@grebyn.com (Checkpoint Technologies) writes: |> >In article <1991Mar26.235643.4498@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: |> >>Given that the compiler is supposed to translate the constant "0" to the |> >>appropriate value for a NULL pointer on the machine type, how does one |> >>get a pointer value whose representation happens to be all zeroes, but |> >>is a non-NULL pointer? |> > |> >void some_func(void) { |> > int **ip; |> > |> > ip = (int **) calloc(sizeof(int *), 1); |> |>The same result (getting a pointer value to be all null bytes) can also be |>achieved by declaring the pointer variable to be either static or/and global, |>since static/global variables are automatically initialized to zeroes. No, that won't work. Statics are not initialized with zero bit patterns. They are initialized as if they were assigned the constant 0. Thus, pointer variables get the Null Pointer, and floats get the bit representation for 0.0. ================== Chris Volpe G.E. Corporate R&D volpecr@crd.ge.com