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

bobduff@world.std.com (Robert A Duff)
Wed, 16 Aug 1995 00:54:40 GMT

          From comp.compilers

Related articles
[20 earlier articles]
Re: Order of argument evaluation in C++, etc. mfinney@inmind.com (1995-08-10)
Re: Order of argument evaluation in C++, etc. hbaker@netcom.com (1995-08-10)
Re: Order of argument evaluation in C++, etc. chase@centerline.com (1995-08-11)
Re: Order of argument evaluation in C++, etc. eggert@twinsun.com (1995-08-13)
Re: Order of argument evaluation in C++, etc. rfg@rahul.net (Ronald F. Guilmette) (1995-08-14)
Re: Order of argument evaluation in C++, etc. graham.matthews@pell.anu.edu.au (1995-08-16)
Re: Order of argument evaluation in C++, etc. bobduff@world.std.com (1995-08-16)
Re: Order of argument evaluation in C++, etc. sethml@sloth.ugcs.caltech.edu (1995-08-16)
Re: Order of argument evaluation in C++, etc. ok@cs.rmit.edu.au (1995-08-16)
Re: Order of argument evaluation in C++, etc. msb@sq.com (1995-08-18)
Re: Order of argument evaluation in C++, etc. ka@socrates.hr.att.com (1995-08-19)
Re: Order of argument evaluation in C++, etc. hbaker@netcom.com (1995-08-21)
Re: Order of argument evaluation in C++, etc. chase@centerline.com (1995-08-21)
[16 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: bobduff@world.std.com (Robert A Duff)
Keywords: C++, optimize, Ada
Organization: The World Public Access UNIX, Brookline, MA
References: 95-07-068 95-08-091
Date: Wed, 16 Aug 1995 00:54:40 GMT

Henry Baker <hbaker@netcom.com> wrote:
>Ada's most objectionable feature, by far, IMHO, is its holier-than-thou
>attitude regarding programming style. Ada goes to a lot of trouble to
>disallow features, constructs, orders of declaration, etc., based not
>on any technical issues, but on some misguided notions about what makes
>good programming style. Indeed, the compiler vendors have to go to
>considerable _extra_ effort to disallow these things.


I agree. Ada 95 is considerably better in this regard than Ada 83 was,
however. For example, the annoying rule about order of declarations has
been removed. Unfortunately, there are still some "stylistic" rules
left -- for example, it's still illegal for a function to have an 'out'
parameter, which is very annoying. Nonetheless, I think Ada 95 is a lot
more friendly in this regard.


- Bob


P.S. I was on the Ada 95 language design team, and I pushed hard against
the "holier-than-thou" attitude you complain about.


P.P.S. Back to the subject at hand (order of evaluation). The rule in
Ada (83 and 95) is that the actual parameters are evaluated in an
arbitrary order, but not in parallel, and not interleaved. I believe
that C++ has the same rule.


I'm not sure this is the best rule -- if I were designing a language
from scratch, I think I would probably specify strictly left-to-right
order, for the reasons various people have stated in this thread. I
wonder if it's possible to design the language so that the compiler has
a better idea of exactly which sub-expressions have side-effects, and
what those side effects are. (Ada and C++ pretty much require the
compiler to assume the worst, for a call to a separately compiled
function.) If the compiler had more information, and the rule was
left-to-right, the compiler could still re-order, and even parallelize,
in many cases, having proven that this is equivalent. Anybody know of
languages that have this property?
--


Post a followup to this message

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