Re: Re: Order of argument evaluation in C++, etc.

William D Clinger <>
Wed, 9 Aug 1995 16:35:43 GMT

          From comp.compilers

Related articles
Re: Order of argument evaluation in C++, etc. (1995-08-07)
Re: Re: Order of argument evaluation in C++, etc. (William D Clinger) (1995-08-09)
| List of all articles for this month |

Newsgroups: comp.compilers
From: William D Clinger <>
Keywords: design, optimize
Organization: Compilers Central
References: 95-08-067
Date: Wed, 9 Aug 1995 16:35:43 GMT (David Chase) writes:
>Perhaps I, too, have become a crank on this subject, but I haven't
>seen anyone point out a benefit that any programmer actually derives
>from ambiguous order of (side-effect-containing) expression evalation
>(in practice, not in theory).

IEEE/ANSI Scheme allows the compiler to re-order certain expressions
that may contain side effects. Both Twobit and Chez Scheme do this
as an optimization. As compiled by Twobit for the SPARC, this
optimization reduces the code size for Larceny v0.24 from 489456 to
452872 bytes, a savings of 7.5%.

I happen to agree with Chase that, for a side-effect-happy language
like C or C++, the disadvantages of leaving the order of evaluation
unspecified are so great that they may indeed outweigh the advantages.
I am responding lest someone actually believe his argument that there
are no advantages, that no "real compiler" optimizes the order of
evaluation of expressions that may have side effects, or that his
arguments might apply to languages other than C and C++.

William D Clinger

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.