From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Software landmines (was: Why C++ is successful)
Date: 1998/09/08
Date: 1998-09-08T00:00:00+00:00 [thread overview]
Message-ID: <Eyz7Co.J4t.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 6t1b6o$ldk$1@nnrp1.dejanews.com
dewarr@my-dejanews.com wrote:
: In article <35F3FF42.D1E163E0@elca-matrix.ch>,
: Mats.Weber@elca-matrix.ch wrote:
: > John G. Volan wrote:
: >
: > > > declare
: > > > A : Integer renames Get_A (10);
: > > > B : Float renames Get_B (X);
: > > > C : Boolean renames Get_C (Y);
: > > > begin
: > > > Op (A, B, C);
: > > > end;
: > >
: > > I'm curious: Does this have the same effect as the above, i.e., are the
: > > function calls forced into a sequential order? Or is their evaluation
: > > deferred until the aliases A, B, and C are actually used as parameters
: > > to the Op call, in which case the aliased function calls get executed in
: > > an undefined order?
: >
: > Yes, it has the same effect. Each function call is evaluated during the
: > elaboration of the renames it appears in. You are in fact renaming the object
: > that contains the function result. (See RM 3.3(10)).
: >
: I must say that I find the renaming of function calls
: like this to be a confusing oddity. It seems much clearer
: to me to use ordinary constant declarations. The two
: seem completely equivalent!
They are equivalent unless the result type is return-by-reference.
If the result-type is return-by-reference, only the rename would be legal,
and simply denotes the same object denoted by the original return statement's
expression.
If the result-type is the more common return-by-reference,
then the two are equivalent for all intents and purposes, though you
might think that the renaming approach could result in fewer copies
in some (not-too-smart ;-) compilers.
By the way, the original point that a "smart" compiler can parallelize:
Op(Get_A(..), Get_B(..), Get_C(..))
more easily than the "sequential" form involving named constants is a
bit bogus. To parallelize, the compiler needs to prove that Get_A,
Get_B, and Get_C don't interfere with one another. Given that, there
is no reason that the "sequential" form couldn't be parallelized as well.
--
-Tucker Taft stt@inmet.com http://www.inmet.com/~stt/
Intermetrics, Inc. Burlington, MA USA
An AverStar Company
next prev parent reply other threads:[~1998-09-08 0:00 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-08-22 0:00 Software landmines (was: Why C++ is successful) dewar
1998-08-23 0:00 ` Dale Stanbrough
1998-08-23 0:00 ` dewar
1998-08-23 0:00 ` Andi Kleen
1998-08-24 0:00 ` Richard D Riehle
1998-08-25 0:00 ` dennison
1998-08-25 0:00 ` Andi Kleen
1998-08-25 0:00 ` Brian Rogoff
1998-08-28 0:00 ` Matthew Heaney
1998-08-28 0:00 ` Richard D Riehle
1998-08-29 0:00 ` Matthew Heaney
1998-09-06 0:00 ` John G. Volan
1998-09-07 0:00 ` Mats Weber
1998-09-07 0:00 ` dewarr
1998-09-08 0:00 ` Tucker Taft [this message]
1998-09-08 0:00 ` Precalculation of parameters (was: Software landmines) dennison
1998-09-09 0:00 ` Tucker Taft
1998-09-09 0:00 ` dennison
1998-09-10 0:00 ` Tucker Taft
1998-09-10 0:00 ` dewarr
1998-09-16 0:00 ` Software landmines (was: Why C++ is successful) Matthew Heaney
1998-08-29 0:00 ` Matthew Heaney
[not found] ` <35eca5d9.4354839@news.geccs.gecm.com>
1998-09-01 0:00 ` Richard D Riehle
-- strict thread matches above, loose matches on Subject: below --
1998-08-06 0:00 Why C++ is successful Robert Dewar
1998-08-07 0:00 ` harald.mueller
1998-08-07 0:00 ` Brian Rogoff
1998-08-07 0:00 ` Timothy Welch
1998-08-08 0:00 ` Robert Dewar
1998-08-08 0:00 ` Jeffrey C. Dege
1998-08-10 0:00 ` Laurent GUERBY
1998-08-12 0:00 ` Andy Ward
1998-08-14 0:00 ` Robert Dewar
1998-08-14 0:00 ` Software landmines (was: Why C++ is successful) dennison
1998-08-15 0:00 ` Thaddeus L. Olczyk
1998-08-16 0:00 ` Robert Dewar
1998-08-17 0:00 ` dennison
1998-08-18 0:00 ` adam
1998-08-19 0:00 ` Tucker Taft
1998-08-19 0:00 ` adam
1998-08-19 0:00 ` ell
1998-08-19 0:00 ` Charles Hixson
1998-08-19 0:00 ` adam
1998-08-19 0:00 ` Dan Higdon
1998-08-20 0:00 ` adam
1998-08-20 0:00 ` Dan Higdon
[not found] ` <m33eagru5g.fsf@mheaney.ni.net>
1998-08-31 0:00 ` Frank Adrian
1998-08-31 0:00 ` Robert I. Eachus
1998-08-31 0:00 ` Biju Thomas
1998-08-31 0:00 ` Robert Martin
1998-09-01 0:00 ` Martin Dowie
1998-09-01 0:00 ` Robert I. Eachus
1998-09-02 0:00 ` dennison
1998-09-01 0:00 ` dewarr
1998-09-06 0:00 ` Jonathan Guthrie
1998-08-20 0:00 ` Ell
1998-08-21 0:00 ` Ell
1998-08-21 0:00 ` Larry Brasfield
1998-08-21 0:00 ` Bob Collins
1998-08-21 0:00 ` Jeffrey C. Dege
1998-08-20 0:00 ` Phlip
1998-08-21 0:00 ` Larry Brasfield
[not found] ` <DOSXjHE9T6DM9Jw9nAyaPxfz@news.rdc1.bc.wave.home.com>
1998-08-22 0:00 ` dewar
1998-08-24 0:00 ` dennison
1998-08-28 0:00 ` Matthew Heaney
1998-08-28 0:00 ` dennison
1998-08-30 0:00 ` Matthew Heaney
1998-09-06 0:00 ` John G. Volan
1998-08-31 0:00 ` Robert I. Eachus
1998-08-24 0:00 ` Martin Dowie
1998-08-24 0:00 ` Martin Dowie
1998-08-24 0:00 ` Mark A Biggar
1998-08-25 0:00 ` Martin Dowie
1998-08-25 0:00 ` Mark A Biggar
1998-08-26 0:00 ` Martin Dowie
1998-08-25 0:00 ` adam
1998-09-22 0:00 ` Charles H. Sampson
1998-08-21 0:00 ` Ell
1998-08-21 0:00 ` John Goodsen
1998-08-21 0:00 ` Ell
1998-08-21 0:00 ` Ell
1998-08-20 0:00 ` Gerry Quinn
1998-08-16 0:00 ` Jay Martin
1998-08-17 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox