Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps From: flaps@dgp.toronto.edu (Alan J Rosenthal) Newsgroups: comp.lang.c Subject: Re: Creating pointer with all bits 0 Message-ID: <1989Sep6.125203.19696@jarvis.csri.toronto.edu> Date: 6 Sep 89 16:52:03 GMT References: <1989Aug31.052756.18524@sq.sq.com> <2030@se-sd.NCR.COM> <1989Sep6.052228.17374@algor2.algorists.com> Lines: 20 Really, an implementation is free to accept "*(char *)0 = 5;" as an instruction to set memory location zero to 5. Dereferencing a null pointer gets undefined behaviour. This is a non-problem. jeffrey@algor2.algorists.com (Jeffrey Kegler) writes: >Question: Is an implementation whose null pointer is the same as the >result of some integer-to-pointer cast conforming? Apparently not, >since 3.2.2.3 states, "... a null pointer is guaranteed to compare >unequal to a pointer to any object or function." I think the contents of a special memory location is not necessarily an "object" in the pANS sense. In any case, dereferencing the null pointer is an implementation-specific way of accessing this memory location, and need not be construed as a normal pointer dereference (although it would probably be implemented as such). For example, the (FILE *)0 argument to fclose() to close all fps is not a pointer to an object, although if only one file is open it does refer to an object. ajr