Xref: utzoo comp.unix.wizards:17331 comp.lang.c:20012 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.wizards,comp.lang.c Subject: Re: Referencing NULL pointers Message-ID: <10556@smoke.BRL.MIL> Date: 19 Jul 89 07:10:59 GMT References: <32UP02Eg3d=801@amdahl.uts.amdahl.com> <1382@bruce.OZ> <1759@cadillac.CAD.MCC.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn) Followup-To: comp.lang.c Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 14 In article <1759@cadillac.CAD.MCC.COM> ned%cad@MCC.COM (CME Ned Nowotny) writes: >However, there are environments where addresses can be represented >by numeric constants and there really is something important at address 0. There better not be. C guarantees that valid object addresses compare unequal to null pointers, and since a null pointer constant is written as "0" in C source code, you cannot obtain a valid object address by casting 0 to the object pointer type. If this is really a problem for some implementation, then it can arrange for the "equivalent integer" mapped form of pointers to be essentially the conventional machine address plus one, or some similar mapping that keeps 0 from appearing to be a possible valid object address in a C program.