Expressions in initializers

Henry Spencer henry at zoo.toronto.edu
Sat Mar 9 02:42:14 AEST 1991


In article <2842 at wn1.sci.kun.nl> hansm at 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 at zoo.toronto.edu  utzoo!henry



More information about the Comp.lang.c mailing list