From -2819250164391385238
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8ba01a147f26fb88
X-Google-Attributes: gidf78e5,public
From: "Paul D. DeRocco" <pderocco@ix.netcom.com>
Subject: Re: ++var and throw
Date: 1999/09/23
Message-ID: <37E94BBC.DC779CF0@ix.netcom.com>#1/1
X-Deja-AN: 528452774
X-NNTP-Posting-Host: 24.128.183.3
Content-Transfer-Encoding: 7bit
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <7sb2gi$qbg3@interserv.etn.com>
X-Accept-Language: en
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@mediaone.net
X-Trace: ndnws01.ne.mediaone.net 938036157 24.128.183.3 (Wed, 22 Sep 1999 17:35:57 EDT)
Organization: Vast Right-Wing Conspiracy
Mime-Version: 1.0
NNTP-Posting-Date: Wed, 22 Sep 1999 17:35:57 EDT
Newsgroups: comp.std.c++
Originator: clamage@taumet


Ed Brey wrote:
> 
> In the spirit of the ++var thread, I have a spin-off question (I
> coincidentally just ran into this while doing real work).  Consider the
> statement:
> 
> *p++ = f();
> 
> If f() throws, is p guaranteed to not be incremented?  Where does the IS
> define this or say that it is undefined?

There is no sequence point anywhere within that expression. Therefore, the
parts of it may be evaluated in any order. Even if the operators were
user-defined member functions, there's no guarantee of the order in which
they'll be called.

If you wrote "f(*p++);", then things would be different, because there is a
sequence point between the evaluation of any function's arguments and the
body of the function itself, so the increment will have taken place.

Sequence points are described in section 1.9 of the standard.

-- 

Ciao,                       Paul D. DeRocco
Paul                        mailto:pderocco@ix.netcom.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://reality.sgi.com/austern_mti/std-c++/faq.html              ]




