From 1857085546670275519
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,7522e5259f7267d6
X-Google-Attributes: gidf78e5,public
From: jpotter@falcon.lhup.edu (John Potter)
Subject: Re: x = y = z;  Undefined?
Date: 2000/01/09
Message-ID: <3876254a.30903561@news.csrlink.net>#1/1
X-Deja-AN: 569987823
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <MPG.12ddaa92533ae9679896a6@news.supernews.com> <t7so0bqea7.fsf@calumny.jyacc.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 947344305 mail2news:11704 mail2news mail2news.demon.co.uk
Organization: Newscene Public Access Usenet News Service (http://www.newscene.com/)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Nntp-Posting-Date: Fri, 07 Jan 2000 12:11:35 CST
Newsgroups: comp.std.c++

On 6 Jan 2000 19:02:58 GMT, Hyman Rosen <hymie@prolifics.com> wrote:

: 
: smeyers@aristeia.com (Scott Meyers) writes:
: >   int i1, i2, i3;
: >   (i1 = i2) = i3;
: > 
: >   1.  Does the above example run afoul of the rule against modifing an
: >       object more than once without an intervening sequence point?
: 
: Yes.

Agreed.  Returning references has added something new to C++ while the
old C rules about sequence points still hold.  The only undefined
behavior that I have managed to observe in these cases was exactly
what I expected.  I understand that this is acceptable undefined
behavior.  My problem is that I can't seem to imagine a sane
implementation doing anything else.  In the interest of understanding
why it is undefined behavior (other than the standard tells me so),
could someone give an example of translation which would produce
something other than expected?

   (i1 = i2) += i3;
   ++ ++ i1;
   int* pi = &(i2 = i1); // This one is well behaved

These are syntax errors in C; so, there is no precedent.

John

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




