From 6801592419014289525
X-Google-Thread: f78e5,52112cea9d2ccd4a
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: squell@alumina.nl (Marc Schoolderman)
Newsgroups: comp.std.c++
Subject: Re: =?ISO-8859-1?Q?=A75=2E2=2E2/8_unspecified_evluation_od?=
 =?ISO-8859-1?Q?er=3F?=
Date: Mon, 25 Jul 2005 19:06:16 GMT
Lines: 39
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <42E4EB01.9020700@alumina.nl>
References: <CsidnX1xcd4C73_fRVn-tA@speakeasy.net>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1122318381 22104 158.152.254.254 (25 Jul 2005 19:06:21 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 25 Jul 2005 19:06:21 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.6) Gecko/20050319
X-Accept-Language: en-us, en
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j6PJ6GfT001982;
	Tue, 26 Jul 2005 05:06:16 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:1476

Steven T. Hatton wrote:

> Do compilers really take advantage of this flexibility?  How much does it
> buy?  Has the theoretical problem actually manifested itself in production
> code?  Would specifying order on the evaluation of function arguments
> impose great hardship on implementers?  Would it adversely impact execution
> speed, compile time, or code size?  How much?

An equally important question is, "What would it gain?". This is not a
theoretical problem, it has a lot to do with calling conventions.

The basic model is that on a function call, a compiler pushes all its
arguments on a stack. Which means there are two main ways to do this,
left-to-right, or right-to-left.

This choice is not arbitrary. Most C/C++ implementations will probably
push right-to-left, so that the first argument will always be at a fixed
distance from the stack top.

However, other languages/systems will have different calling
conventions, and implementations usually offer special specifiers to
adjust to them (_pascal, _cdecl, _fastcall, _stdcall, etc.)

If C++ mandated an evaluation order, this means inefficiency for
calling conventions which don't match it, just so that 5 people will get
their degenerate code to work.

~Marc.





---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



