🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1715

Re: static int x[2], *p = x+(x-x); ?

#1715
From: Christopher R Volpe
Date: Mon, 17 Sep 1990 16:03
13 lines
1022 bytes
In article <2752@rossignol.Princeton.EDU>, drh@cs.Princeton.EDU (Dave
Hanson) writes: [in regard to:  static int *s = x + (x-x); ]
|>x-x indeed evaluates to 0 during execution, but compilers are not
|>obliged to recognize it as a constant expression that evaluates to 0
|>during compilation. x-x is not an integral constant expression because
|>its operands are address constants, not integer constants (see sec. 3.4).

Yup. Right. Sorry.
               
==================
Chris Volpe
G.E. Corporate R&D
volpecr@crd.ge.com
Technical Details
Message-ID: <11941@crdgw1.crd.ge.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!crdgw1!underdog!volpe
References: <1990Sep14.015241.2152@twinsun.com> <2699@rossignol.Princeton.EDU> <11907@crdgw1.crd.ge.com> <2752@rossignol.Princeton.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!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: <11941@crdgw1.crd.ge.com>
Date: 17 Sep 90 16:03:23 GMT
References: <1990Sep14.015241.2152@twinsun.com> <2699@rossignol.Princeton.EDU> <11907@crdgw1.crd.ge.com> <2752@rossignol.Princeton.EDU>
Sender: news@crdgw1.crd.ge.com
Reply-To: volpe@underdog.crd.ge.com (Christopher R Volpe)
Lines: 13