Legal forms of constant expressions in initializers
    J. Stephen Adamczyk 
    jsa at edg1.UUCP
       
    Sat Jul  8 02:22:01 AEST 1989
    
    
  
By my reading of section 3.4, both of the following examples are
not legal:
/* 1 */
static int i = "abc"[2];
/* 2 */
static int a[5];
static int j = &a[3] - &a[2];
The second example, in particular, is interesting, since by my reading
K&R (first edition) allows it, and the pcc-based compiler on my Sun does
too.
Anyone feel these are legal?  Have I read the text wrong?
Steve Adamczyk
uunet!edg1!jsa
(201) 769-8262
    
    
More information about the Comp.std.c
mailing list