From 8719922059738149165
X-Google-Thread: f78e5,52112cea9d2ccd4a
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news1.google.com!newsread.com!newsprint.newsread.com!newsfeed.stueberl.de!blackbush.cw.net!cw.net!feed.news.tiscali.de!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: caj@cs.york.ac.uk (chris jefferson)
Newsgroups: comp.std.c++
Subject: Re: =?ISO-8859-1?Q?=A75=2E2=2E2/8_unspecified_evluation_od?=
 =?ISO-8859-1?Q?er=3F?=
Date: Thu,  4 Aug 2005 16:10:51 GMT
Organization: The University of York, UK
Lines: 87
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <42F1C88B.5090307@cs.york.ac.uk>
References: <CsidnX1xcd4C73_fRVn-tA@speakeasy.net>   <42E4EB01.9020700@alumina.nl>   <42E64CCE.7030708@cs.york.ac.uk>   <42E68BDD.1050701@alumina.nl>   <1122649512.879866.38000@g44g2000cwa.googlegroups.com>   <3l12o0F10nuusU1@individual.net>   <0RfHe.2500$%a2.1721@trndny03>   <3l5u7qFvrvk8U1@individual.net>   <200508011747.j71HlbuC069360@horus.isnic.is>   <1122936886.396427.298260@g47g2000cwa.googlegroups.com>   <zMDHe.2564$%a2.2024@trndny03> <1123012422.458492.183540@z14g2000cwz.googlegroups.com>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1123171870 8903 158.152.254.254 (4 Aug 2005 16:11:10 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 4 Aug 2005 16:11:10 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716)
X-Accept-Language: en-us, en
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Path: comp-std-cpp-robomod!not-for-mail
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j74GAptT000678;
	Fri, 5 Aug 2005 02:10:51 +1000 (EST)
X-NNTP-Posting-Date: 4 Aug 2005 07:49:27 GMT
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-York-MailScanner-From: news@york.ac.uk
X-Newsgroups: comp.std.c++
X-York-MailScanner: Found to be clean
Xref: g2news1.google.com comp.std.c++:1654

kuyper@wizard.net wrote:
> Hyman Rosen wrote:
> 
>>kuyper@wizard.net wrote:
>>
>>>Yes, there are cases where even experts disagree about what ordering
>>>requirements the standard imposes.
>>
>>No, that's *not* what I'm saying. Experts don't disagree about what
>>the standard requires, they just make mistakes. We see that here,
>>over and over again.
> 
> 
> Yes, they sometimes make mistakes - which result in disagreements.
> There are also disagreements that arise not because of any mistakes
> that people have made, but because people adopted multiple different
> mutually incompatible interpretations of unclear wording in the
> standard, which are all arguably compatible with the actual wording.
> 
> 
>>>The rule is simple: avoid the tricky cases.
>>
>>Really? So everyone will realize that calling 'f(auto_ptr, auto_ptr)'
>>with 'f(new, new)' is a tricky case and avoid it?
> 
> 
> It's certainly something I'd never have tried.
> 
> 
>>... And everyone will
>>realize that doing 'cout << Start() << Middle() << Finish()' is a
>>tricky case and avoid it?
> 
> 
> No, of course not . Just like not everyone will realize that
> 
>     a = b+c - d+e;
> 
> isn't equivalent to
> 
>     a = (b+c)-(d+e);
> 
> I don't think we should cater to the limitations of the least competent
> users of the language. At some point we should tell them: "this is a
> language without training wheels - it's not for you". There are
> languages more suitable than C++ for such people, though I'd expect
> them to have a certain amount of trouble even when using the most
> user-friendly of languages.
> 

I do quite a lot of programming in quite a lot of languages, and was
recently caught by the non-ordering of function arguments.

I often program in pure functional languages. There you often don't get
a well-defined order of execution, but on the other hand, it doesn't
matter as your functions don't have side effects.

While I probably haven't thought through all the consequences, If I was
in charge of designing C++, I would want a policy that a correct program
produced identical output on every compiler (well, modulo things like
types changing size), so I'd also fix the execution order of all the
operators as well. It disturbs me that one day, at a slightly changed
optimisation level, or using a new compiler, my program could change
symantics.

I'm a strong believer in unit tests, I usually have more tests than
code, and it makes me confident that my code is doing exactly what I
want it to do. However, there is no way for me to test for this kind of
thing, other than to see if one day some tester tells me on some obscure
platform or compiler setting suddenly large bunches of tests start failing.

> I agree; that's a problem; improved education or a change of profession
> is the solution.

Can you honestly say you've never been caught by some random part of the
C++ standard? This one I consider espically bad because your code will
compile and run fine until one day some compiler decides to rearrange
the order.

Chris

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



