From 459603140497179769
X-Google-Thread: f78e5,174aa7b34b06a51
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!newsfeed.vmunix.org!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: dave@boost-consulting.com (David Abrahams)
Newsgroups: comp.std.c++
Subject: Re: Is this really unspecified behavior?
Date: Thu, 15 Dec 2005 00:42:32 GMT
Lines: 48
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <ur78f6zcp.fsf@boost-consulting.com>
References: <1132759176.368850.264850@g43g2000cwa.googlegroups.com>
	<H1phf.161529$zb5.99785@bgtnsc04-news.ops.worldnet.att.net>
	<1132933832.802917.153350@g14g2000cwa.googlegroups.com>
	<1133551647.532929.325730@z14g2000cwz.googlegroups.com>
	<1133583412.951239.208510@g49g2000cwa.googlegroups.com>
	<E1EjGBD-0005T8-00@chx400.switch.ch>
	<1133910546.716987.80030@g14g2000cwa.googlegroups.com>
	<E1EjzL6-0006ic-00@chx400.switch.ch>
	<0l5ep1ppfhdj5p1pcu7e4na4ub0vjajlq3@4ax.com>
	<200512131507.jBDF72uC006630@horus.isnic.is>
	<uhd9cdgjq.fsf@boost-consulting.com> <E1EmX4R-0006gj-00@chx400.switch.ch>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.demon.co.uk 1134607359 18809 158.152.254.254 (15 Dec 2005 00:42:39 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 15 Dec 2005 00:42:39 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (windows-nt)
X-DMCA-Complaints-To: abuse@rcn.net
X-Greylisting: NO DELAY (Relay+Sender autoqualified);
	processed by UCSD_GL-v2.1 on mailbox8.ucsd.edu;
	Wed, 14 December 2005 15:19:04 -0800 (PST)
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Cancel-Lock: sha1:lHtBM1yOp/DOn6tK+hNbfioDaJc=
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id jBF0gWw5025531;
	Thu, 15 Dec 2005 11:42:32 +1100 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-NNTP-Posting-Date: Wed, 14 Dec 2005 17:19:02 -0600
X-Delivered-To: std-c++@ucar.edu
X-Spamscanner: mailbox8.ucsd.edu  (v1.6 Aug  4 2005 15:27:38, 0.0/5.0 3.0.4)
X-Postfilter: 1.3.32
X-Authentication-Warning: serv3.gc.dca.giganews.com: news set sender to poster@giganews.com using -f
X-Newsgroups: comp.std.c++
X-MailScanner: PASSED (v1.2.8 52874 jBENJ3CW072611 mailbox8.ucsd.edu)
Xref: g2news1.google.com comp.std.c++:2771

hyrosen@mail.com (Hyman Rosen) writes:

> David Abrahams wrote:
>> Let me just point out that the general form
>> of that problem is insoluble:
>>   // safe under left-to-right ordering?
>>   f(g(), new T);
>> As a matter of fact it isn't safe, if f has default arguments.
>> Leaving that aside, will users be reticent to make this transformation
>>   f(new T, g())
>> Does one of those look safer to you?
>
> I'm sorry, but I don't understand what you mean.
>
> Under my proposed new regime, function parameters
> will be constructed from arguments in the call in
> strict left-to-right order, and the arguments will
> be evaluated in strict left-to-right order. If
> constructing a parameter throws an exception,
> previously constructed parameters are destructed
> in reverse order. So in the examples, if the new T
> argument is for an auto_ptr<T> parameter, then both
> versions are equally safe. In the first case, if
> g() throws then new T will never be called, and in
> the second case if g() throws then the auto_ptr<T>
> parameter of f will be destructed and thus the
> new T pointer will be freed.

f doesn't have an auto_ptr<T> parameter.  It takes two pointers.

> So please explain why you think that the general
> case is unsafe, or why people will have to change
> parameter order.

It's not about "having to" change.  It's about whether you'll notice
that the change affects safety.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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



