From 7644333778148592421
X-Google-Thread: f78e5,174aa7b34b06a51
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,CP1252
Path: g2news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.cw.net!news-FFM2.ecrc.de!news-raspail.gip.net!news-lond.gip.net!news.gsl.net!gip.net!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: ron@spamcop.net (Ron Natalie)
Newsgroups: comp.std.c++
Subject: Re: Is this really unspecified behavior?
Date: Thu, 24 Nov 2005 19:03:49 GMT
Organization: Newshosting.com - Highest quality at a great price! www.newshosting.com
Lines: 39
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <4385d50d$0$28516$9a6e19ea@news.newshosting.com>
References: <1132629737.664847.151630@o13g2000cwo.googlegroups.com>   <1132722639.345095.296070@f14g2000cwb.googlegroups.com>   <200511231401.jANE1BuC092897@horus.isnic.is> <1132786459.216137.307610@z14g2000cwz.googlegroups.com>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: news.demon.co.uk 1132859038 15126 158.152.254.254 (24 Nov 2005 19:03:58 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 24 Nov 2005 19:03:58 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Thunderbird 1.4 (Windows/20050908)
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.cs.mu.OZ.AU id jAOJ3r5s020923
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 jAOJ3nkp020896;
	Fri, 25 Nov 2005 06:03:49 +1100 (EST)
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++:2589

pongba@gmail.com wrote:
> Hyman Rosen wrote:

> yeah, that's where my doubt lies exactly. The standard says that "i =3D
> v[i++]" has unspecified behavior, but according to what you have said,
> it should just be undefined behavior.
> Is there anything wrong with the corresponding standard wording?
>=20
The order of evaluation is unspecified, but changing the value twice
between sequence points is undefined behavior.   With built-in
operators there are no sequence points other than the end of the
full expression.


Fourth paragraph of Chapter 5 -- Expressions from the standard.

Except where noted, the order of evaluation of operands of individual=20
operators and subexpressions of individual
expressions, and the order in which side effects take place, is=20
unspecified.53) Between the previous
and next sequence point a scalar object shall have its stored value=20
modified at most once by the evaluation
of an expression. Furthermore, the prior value shall be accessed only to=20
determine the value to be stored.
The requirements of this paragraph shall be met for each allowable=20
ordering of the subexpressions of a full
expression; otherwise the behavior is undefined. [Example:
i =3D v[i++]; // the behavior is unspecified
i =3D 7, i++, i++; // i becomes 9
i =3D ++i + 1; // the behavior is unspecified
i =3D i + 1; // the value of i is incremented
=97end example]

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



