From -512036382495802943
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,7522e5259f7267d6
X-Google-Attributes: gidf78e5,public
From: Anthony DeRobertis <derobert@erols.com>
Subject: Re: x = y = z;  Undefined?
Date: 2000/01/11
Message-ID: <derobert-8223E1.23372510012000@news.erols.com>#1/1
X-Deja-AN: 571116101
Content-Transfer-Encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <MPG.12ddaa92533ae9679896a6@news.supernews.com> <t7so0bqea7.fsf@calumny.jyacc.com> <3876254a.30903561@news.csrlink.net> <derobert-9FC87E.01591309012000@news.erols.com> <3879ca08.3142429@news.csrlink.net>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
Content-Type: text/plain; charset=ISO-8859-1
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 947584293 mail2news:15675 mail2news mail2news.demon.co.uk
Organization: -
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
User-Agent: MT-NewsWatcher/3.0 (PPC)
Mime-Version: 1.0
Nntp-Posting-Date: 11 Jan 2000 04:37:25 GMT
Newsgroups: comp.std.c++

In article <3879ca08.3142429@news.csrlink.net>, jpotter@falcon.lhup.edu 
(John Potter) wrote:

>On Mon, 10 Jan 2000 08:28:54 CST, Anthony DeRobertis
><derobert@erols.com> wrote:
>
>: In article <3876254a.30903561@news.csrlink.net>, 
>: jpotter@falcon.lhup.edu (John Potter) wrote:
>: 
>: 
>: >could someone give an example of translation which would produce
>: >something other than expected?
>: >
>: >   (i1 = i2) += i3;
>: 
>: Well, on my PowerPC this would generate (unoptimized):
>: -- sequence point --
>: or i1,i2,i2
>: add i1,i1,i3
>: -- sequence point --
>: 
>: Which could legally be re-arranged:
>: add i1,i1,i3
>: or i1, i2, i2
>
>I don't think so.
 
<snip>

The standard, by saying that a value can't be modified twice between 
sequencing points, has disallowed this dependency. The compiler need not 
check if a new value for an variables depends on another new value 
inside the same sequencing point, and there is no reason to expect that 
it does check.

One could concieve a compiler that would decide 'ok, the final 
destination is i1' and then add three too it. Then manage the assign 
i1=i2 after it. Since there can be no more than one assignment to a 
single variable in a sequencing point, there's nothing wrong with this 
implementation, either.

-- 
Windows 95 (win-DOH-z), n. A thirty-two bit extension and graphical shell
to a sixteen bit patch to an eight bit operating system originally coded
for a four bit microprocessor which was used in a PC built by a formerly
two bit company that couldn't stand one bit of competition.

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




