Path: utzoo!mnetor!uunet!mcvax!ukc!eagle!icdoc!cam-cl!am From: am@cl.cam.ac.uk (Alan Mycroft) Newsgroups: comp.lang.c Subject: Re: ! operator in constant expressions Message-ID: <1132@jenny.cl.cam.ac.uk> Date: 29 Jan 88 15:59:57 GMT References: <3813@hoptoad.uucp> <660003@hpclsue.HP.COM> Reply-To: am@cl.cam.ac.uk (Alan Mycroft) Organization: U of Cambridge Comp Lab, UK Lines: 23 I hope the public review draft is a little more precise.... In article <660003@hpclsue.HP.COM> sue@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?