Re: Guarantee of side-effect free assignment
On Oct 10, 6:14 pm, al...@start.no ("Alf P. Steinbach") wrote:
* James Kanze:
I'd be very cautious about bringing the Meyers/Alexandrescu
discussion in here. They were interested solely with threading
issues.
Yes. What's interesting here is not the threading issues, but the
freedom the compiler has to reorder this particular expression, which in
the article is a premise for the threading issues discussion. This
premise is not said to rely on any threading considerations.
Except that in their example, the compiler was clearly allowed
to rearrange the order because of the "as if" rule. They
weren't concerned about a possible exception, and didn't
consider that aspect. And if the constructor can't throw, I
don't think that there's any disagreement that reordering is
legal, since the "as if" rule allows it, if nothing else does.
A compliant (single threaded) program can't tell.
Summary: some folks think the standard allows the reordering,
some folks think it doesn't, and the latest draft adds
language that seemingly forbids the reordering, but has
already been contested in this thread.
Summary of the summary: hm. :-)
That we disagree as to what the standard actually says (or is
trying to say), but we agree (I think) as to what it should say.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
---
[ 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.comeaucomputing.com/csc/faq.html ]