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

dmk@dmk.com (David Keaton)
Fri, 21 Jul 1995 02:25:32 GMT

          From comp.compilers

Related articles
Order of argument evaluation in C++, etc. hbaker@netcom.com (1995-07-08)
Re: Order of argument evaluation in C++, etc. wclodius@lanl.gov (WIlliam B. Clodius) (1995-07-10)
Re: Order of argument evaluation in C++, etc. chase@centerline.com (1995-07-12)
Re: Order of argument evaluation in C++, etc. hbaker@netcom.com (1995-07-18)
Re: Order of argument evaluation in C++, etc. stefan.monnier@epfl.ch (Stefan Monnier) (1995-07-20)
Re: Order of argument evaluation in C++, etc. dmk@dmk.com (1995-07-21)
Re: Order of argument evaluation in C++, etc. jhallen@world.std.com (1995-07-21)
Re: Order of argument evaluation in C++, etc. hbaker@netcom.com (1995-07-26)
Re: Order of argument evaluation in C++, etc. karlcz@moraine.hip.berkeley.edu (1995-07-26)
Re: Order of argument evaluation in C++, etc. Steve_Kilbane@cegelecproj.co.uk (1995-07-26)
Re: Order of argument evaluation in C++, etc. chase@centerline.com (1995-07-28)
Re: Order of argument evaluation in C++, etc. davids@ICSI.Berkeley.EDU (1995-07-30)
[37 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: dmk@dmk.com (David Keaton)
Keywords: C++, optimize
Organization: David M. Keaton, Boulder, CO, USA
References: 95-07-068 95-07-113
Date: Fri, 21 Jul 1995 02:25:32 GMT

hbaker@netcom.com (Henry Baker) writes:
>Thus, if you were computing f(g(x),h(x)), the compiler is currently free
>to _interlace_ the steps of computing g(x) with those of h(x) in any arbitrary
>order, which will cause great mischief if g(x) and h(x) are accessing some
>shared resource.


          Actually, this isn't the case. According to the current C++
Working Paper, subclause 1.8 [intro.execution], paragraph 8, "Once the
execution of a function begins, no expressions from the calling
function are evaluated until execution of the called function is
completed.[footnote 6]"


          Therefore, once g(x) is called, h(x) cannot be called until g(x)
finishes, and vice versa. Now, the above wording does contain a race
condition in the case that g(x) and h(x) start simultaneously.
However, footnote 6 makes the intention of the draft clear: "In other
words, function executions do not interleave with each other."
Because of this, anyone who writes a compiler that interleaves
function executions will not be able to claim conformance when the
clarified final draft of the C++ standard comes out.


          Speaking of the C++ Working Paper, it is out for public review.
It can be found at the following locations.
ftp://research.att.com/dist/stdc++/WP
http://www.cygnus.com/~mrs/wp-draft/
http://maths.warwick.ac.uk/c++/
ftp://maths.warwick.ac.uk/pub/c++/std/wp/
ftp://ftp.su.edu.au/pub/C++/CommitteeDraft/
ftp://ftp.mch.sni.de/pub/documents/c++/
http://www.dcs.hull.ac.uk/cw/C++.wp-draft/index.html
http://www.ph.tn.tudelft.nl/People/klamer/wp/index.html
Now is your chance to get your comments to the committee.


David Keaton
dmk@dmk.com
http://www.dmk.com/~dmk
--


Post a followup to this message

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