for(;;) vs. while(1) is a draw

Stephen Clamage steve at taumet.COM
Sat May 26 02:21:59 AEST 1990


In article <Z4O3P:2 at xds13.ferranti.com> peter at ficc.ferranti.com (Peter da Silva) writes:
>... [this would mean that]
>the compiler can legally generate any code it likes for anything, so long
>as the semantics match the abstract machine. The compiler is permitted
>to generate any code it likes ...

Yup.  That's exactly what the ANSI standard says.  The standard makes
heavy use of the "as-if" rule for this reason.  It doesn't tell the
compiler implementor how to do the job, only what the result must be.
As in your hyperbolic example, a conforming compiler could send mail
to Dennis Ritchie (or to Bob Hope, for that matter) to get a value for
an expression whose semantics are undefined.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.std.c mailing list