constant expressions

Doug Gwyn gwyn at smoke.BRL.MIL
Wed Aug 15 23:09:06 AEST 1990


In article <1923 at tkou02.enet.dec.com> diamond at tkou02.enet.dec.com (diamond at tkovoa) writes:
>Yes, section 3.4 says that a constant expression CAN be evaluated during
>translation.  It is sufficiently clear that the translator is NOT REQUIRED
>to do so.

Wrong, at least when the translator needs to evaluate the expression in
order to perform the translation.  If the translator is able to "intuit"
the correct code without evaluation of constant expressions, it of course
is allowed to do so, since the standard specifies external characteristics
of the programs that a conforming translator must accept, not internal
details of how a translator is actually implemented.  However, a conforming
implementation must ACT exactly as though constant expressions ARE
evaluated in many contexts.  Since I don't believe in magic, I don't know
how it could obtain the required results without in fact evaluating the
expressions, in some meaningful sense of the term "evaluate".



More information about the Comp.std.c mailing list