! operator in constant expressions
Alan Mycroft
am at cl.cam.ac.uk
Sat Jan 30 01:59:57 AEST 1988
I hope the public review draft is a little more precise....
In article <660003 at hpclsue.HP.COM> sue at hpclsue.HP.COM (Sue Meloy) writes:
>According to the latest ANSI draft:
>A constant expression used in a static initializer must evaluate to one of
**** ^^^^^^^^ Duh?
>the following:
> an arithmetic constant expression
> only arithmetic operands; casts can only be from arithmetic type to
> arithmetic type.
> an address constant
> created via & or by use of an array or function name
**** ^^^^
0. Presumably static.
1. Or array expression? Consider
static struct { int a, b[5]; } x; int *p = x.b;
2. Presumably all subscripts must be arith. const. exprs?
3. What about static int a,*b = &*&a;
> an address constant plus or minus an integral constant expression
****
0. Presumably this applies recursively so that
static int a[10], *b = (&a[0] + 6) - 4;
is OK?
More information about the Comp.lang.c
mailing list