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

Christopher R Volpe volpe at underdog.crd.ge.com
Tue Sep 18 02:03:23 AEST 1990


In article <2752 at rossignol.Princeton.EDU>, drh at 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 at crd.ge.com



More information about the Comp.std.c mailing list