Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!crdgw1!underdog!volpe From: volpe@underdog.crd.ge.com (Christopher R Volpe) Newsgroups: comp.std.c Subject: Re: static int x[2], *p = x+(x-x); ? Message-ID: <11907@crdgw1.crd.ge.com> Date: 14 Sep 90 20:05:56 GMT References: <1990Sep14.015241.2152@twinsun.com> <2699@rossignol.Princeton.EDU> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@underdog.crd.ge.com (Christopher R Volpe) Lines: 16 In article <2699@rossignol.Princeton.EDU>, drh@cs.Princeton.EDU (Dave Hanson) writes: |> static int *s = x + (x-x); /* Does this ``evaluate to'' x+0? */ |> |>even though (x-x) is 0, compilers may not be obliged |>to recognize it as 0 because x-x doesn't conform to the allowable |>expressions you listed above. Yes, they are obliged to recognize it as zero because the two operands (which happen to be identical) are both pointers into the same array. See K&R II A7.7 ================== Chris Volpe G.E. Corporate R&D volpecr@crd.ge.com