From 4398245677376782768
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/13
Message-ID: <387dc78f.4864697@news.csrlink.net>#1/1
X-Deja-AN: 572184621
X-NNTP-Posting-Host: 209.173.92.30
Approved: stephen.clamage@sun.com (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> <derobert-8223E1.23372510012000@news.erols.com> <387b3c32.7816532@news.csrlink.net> <t7d7r8xyxm.fsf@calumny.jyacc.com> <387bc96e.43976982@news.csrlink.net> <t7so03w0xj.fsf@calumny.jyacc.com>
X-UID: 0000000001
X-Status: $$$T
X-Trace: newscene.newscene.com 947767509 209.173.92.30 (Thu, 13 Jan 2000 06:45:09 CST)
Organization: Newscene Public Access Usenet News Service (http://www.newscene.com/)
NNTP-Posting-Date: Thu, 13 Jan 2000 06:45:09 CST
Newsgroups: comp.std.c++
Originator: clamage@taumet


On Thu, 13 Jan 2000 22:45:28 CST, Hyman Rosen <hymie@prolifics.com>
wrote:

: jpotter@falcon.lhup.edu (John Potter) writes:
: > The only way that the mentioned reordering of the instructions is
: > valid is if the compiler detects the undefined behavior.  Thus, the
: > reordering is not valid.
: 
: You are presuming to omnisciently know the behavior of all compilers
: and optimizers, on into the future?

For the given two machine instructions, I think I am safe in that.  They
both modify the same variable with the second using the result of the
first.  Without knowing that there is no sequence point, the
instructions may not be reversed.

: Good for you then, but I think I
: will avoid undefined behavior nonetheless.

Me too.  I just asked for a real example.  That one was not.  It
sometimes helps to understand why the standard makes something
undefined.

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              ]




