Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!think.com!paperboy!osf.org!dbrooks From: dbrooks@osf.org (David Brooks) Newsgroups: comp.lang.c Subject: Re: argv[] terminated by a NULL pointer? Message-ID: <23292@paperboy.OSF.ORG> Date: 28 Jun 91 14:29:52 GMT References: <12187@hub.ucsb.edu> <14603@dog.ee.lbl.gov> <1991Jun28.052339.14611@ringer.cs.utsa.edu> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 23 djimenez@ringer.cs.utsa.edu (Daniel Jimenez) writes: |> Who said the null pointer couldn't be -1? Who's allowed to know? |> On a system where the null pointer is represented by all bits one, |> the following statement: |> ((char *)0) == ((char *)-1) |> would be true, since 0 in a pointer context is defined to be |> the null pointer, and -1 is also the null pointer. |> They would have the same bit pattern. Is this strictly true? I know that the conversion of an *object* of integral type is allowed to go through an implementation-dependent mapping, although K&RII (at least) doesn't seem to mention an integer constant. It would be rather perverse to map (char *)-1 to 0x8129ac60, but I could imagine a compiler writer wanting to avoid mapping -1 to a value internally identical to a null pointer. -- David Brooks dbrooks@osf.org Systems Engineering, OSF uunet!osf.org!dbrooks Composing for a percussion ensemble is like writing an essay in highlighter.