From -1529696741336570777
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,7522e5259f7267d6
X-Google-Attributes: gidf78e5,public
From: "Bill Wade" <bill.wade@stoner.com>
Subject: Re: x = y = z; Undefined?
Date: 2000/01/14
Message-ID: <85oc1c$vk7@library2.airnews.net>#1/1
X-Deja-AN: 572788558
X-NNTP-Posting-Host: !e,nM1k-VT>N*R/ (Encoded at Airnews!)
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <3874B57E.CC4CD74B@fnal.gov> <85mtg5$ii6$1@nntp6.atl.mindspring.net>
X-UID: 0000000001
X-Status: $$$T
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Neosoft (using Airnews.net!)
Abuse-Reports-To: abuse at airmail.net to report improper postings
Newsgroups: comp.std.c++
Originator: clamage@taumet



Zalman Stern wrote in message <85mtg5$ii6$1@nntp6.atl.mindspring.net>...
>
> [ Argues that the standard does not make it explicit that
>      &(x=y) == &x
> ]
>
>A number of smart people agreed that the standard did not make this
>explicit and I concluded that you *never* want to write code like that.
>Can't see how anything has changed here for the final standard.
>
>Andrew Koenig's post indicates that the intent of the standard is that a
>reference to x is required above, but there is certainly some contention
>about whether that intent is expressed in the language of the standard.

I agree that the wording is not explicit.  I disagree that any other
interpretation is reasonable.  I also note that the same style of wording is
used with both ?: and prefix ++.  I hope anyone that argues that
   int x=0;
   int* px = &x;
   assert(&(x=x) == px);
is allowed to fail will also argue that
   assert(&(x?x:x) == px);
   assert(&(++x) == px);
are both allowed to fail.

5.3.2 (++) "The value is the new value of the operand.  It is an lvalue."
5.16/4 (?:) "The result is of that type and is an lvalue."
5.17/1 (=) "The result ... is the value stored in the left operand ... the
result is an lvalue"

The wording is much tighter for parenthesis, &(x)==&x, and unary*, &*&x ==
&x.  However in all cases the intent is clear.




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




