Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Expressions in initializers Message-ID: <1991Mar8.164214.11287@zoo.toronto.edu> Date: Fri, 8 Mar 1991 16:42:14 GMT References: <1991Mar4.144939.8311@ux1.cso.uiuc.edu> <1032@caslon.cs.arizona.edu> <3599.27d3ca8a@iccgcc.decnet.ab.com> <2842@wn1.sci.kun.nl> Organization: U of Toronto Zoology In article <2842@wn1.sci.kun.nl> hansm@cs.kun.nl (Hans Mulder) writes: >>So a conforming compiler is free to consider sqrt(2.0) to be a >>compile-time constant. > >Nope. The ANSI standard gives an exhaustive list of operators that >can appear in a "constant expression" as required in an aggregate >initialiser and function calls are not on the list. Nope. :-) 3.4: "An implementation may accept other forms of constant expressions." It is legitimate for an implementation to take that as a constant expression, although the usage is not portable. Incidentally, where did you find the "exhaustive list"? K&R used to give such a list (which had at least one error in it!), but the definition of constant expressions in X3.159-1989 section 3.4 doesn't do it that way. -- "But this *is* the simplified version | Henry Spencer @ U of Toronto Zoology for the general public." -S. Harris | henry@zoo.toronto.edu utzoo!henry