From 7193023841580121002
X-Google-Thread: f78e5,52112cea9d2ccd4a
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!newspeer.monmouth.com!newshosting.com!nx02.iad01.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!peer-uk.news.demon.net!kibo.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: Tue, 26 Jul 2005 16:17:06 GMT
Lines: 67
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <42E62FB2.4090003@alumina.nl>
References: <CsidnX1xcd4C73_fRVn-tA@speakeasy.net> <42E4EB01.9020700@alumina.nl> <20050725193339.5F435103B5@mscan3.ucar.edu>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: news.demon.co.uk 1122394661 27176 158.152.254.254 (26 Jul 2005 16:17:41 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 26 Jul 2005 16:17:41 +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-MIME-Autoconverted: from 8bit to quoted-printable by mulga.cs.mu.OZ.AU id j6QGHbPB008368
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 j6QGH687008120;
	Wed, 27 Jul 2005 02:17:06 +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++:1499

(I'll keep my fingers crossed and hope my newsreader will let this post
through just once, which is quite enough..:)

Hyman Rosen wrote:

> No. First and foremost, it means that code will work
> the same way on all platforms, instead of encountering
> implementation dependencies that may change its behavior
> when porting to a different platform/compiler/version.

I think this is negligible compared to other issues like a system
library causing subtleties, or code that relies on implementation
defined properties of integer types.

> Second, pushing an argument onto the call stack is no
> more efficient than first allocating sufficient space
> for all the arguments and then simply moving each
> parameter into the appropriate slot.

This isn't true on every architecture. Of course it's possible to
allocate a chunk of memory on the stack and assign to the available
memory slots. However, there is no free lunch;

"Replacing PUSH and POP instructions with MOV instructions can reduce
stack pointer dependencies and uses fewer execution resources. This
optimization is usually most effective in smaller routines. Excessive
use of this optimization can result in increased code size as MOV
instructions are considerably larger than PUSH and POP instructions."

(=A75.13 in http://www.amd.com/us-en/assets/content_type/
white_papers_and_tech_docs/25112.PDF.)

C++ should leave implementation decisions to the implementors.

> Third, non-legacy architectures tend to pass their
> parameters in registers rather than the stack.

You cannot afford to disregard register-deprived "legacy" architectures,
since one is in very wide use indeed(!), and likely to remain so for at
least another decade.

I also think a lot of embedded systems fall in this category.

> Fourth, unless a particular function call actually
> contains order dependencies, the compiler can do the
> evaluations in any order anyway, under the as-if rule.

This isn't good enough, since everything except basic operations on
built-in types can throw, strapping the compiler in a straight-jacket.

Regarding your other post - I am not convinced that giving obfuscated
statements like;

  i =3D 0; a[i++] =3D ++i; // a[0] =3D 2;

well defined behaviour will have any practical benefit for anybody not
involved in the IOCCC. :)

~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                       ]



