From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Software landmines (was: Why C++ is successful) Date: 1998/09/08 Message-ID: #1/1 X-Deja-AN: 389096740 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: <6t1b6o$ldk$1@nnrp1.dejanews.com> Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-09-08T00:00:00+00:00 List-Id: 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