Path: utzoo!mnetor!uunet!portal!cup.portal.com!Paul_L_Schauble From: Paul_L_Schauble@cup.portal.com Newsgroups: comp.lang.c Subject: Value of a null pointer Message-ID: <4728@cup.portal.com> Date: 23 Apr 88 10:04:45 GMT Distribution: na Organization: The Portal System (TM) Lines: 28 XPortal-User-Id: 1.1001.3295 I don't want to start the null pointer discussion all over again. But I have a co-worker claiming that C requires that a null pointer be binary zero. He cites two reasons: 1. An uninitialized external is set to zero bits. C defines an uninitialized external pointer to be a null pointer. Therefore zero bits must be a null pointer. 2. One can use calloc to allocate an array of pointers. The initial value of this array must be null pointers. calloc sets the area to zero bits. Therefore....... Unfortunately, I don't have a copy of the proposed ANSI standard. My recollection is that in both cases the pointer values are undefined. Also, does the new standard require that a cast of a literal zero always does the right thing? That is, are ptr_type_var = (ptr_type)0; /* assigns null pointer */ ptr_type_var = 0; /* assigns null pointer */ func( (ptr_type)0 ); /* function expecting pointer type */ Are all of these always correct? I believe that C does not require the null pointer to be zero and that there are machines running it where the null pointer is non-zero. What I need, if possible, are specific citations. Thanks, Paul