This is the mail archive of the
mailing list for the GCC project.
Re: Volatile MEMs in statement expressions and functions inlined as trees
Richard Henderson <email@example.com> writes:
| On Thu, Dec 13, 2001 at 11:41:37PM +0100, Gabriel Dos Reis wrote:
| > The result of the assignment operation is the value stored in
| > the left operand after the assignment has taken place; the result is
| > an lvalue.
| Taken at face value, this would seem to require that
| q = p = 0;
| be implemented as
| q = (tmp = 0, p = tmp, tmp);
| where "tmp" is the lvalue.
If implemented that way, how do you explain that
int x = 0;
int& f(int y)
return x = y;
returns a reference to x -- which if I corerectly undertand Andy
Koenig's explanation motivates the incompatibility introduced in C++?
| Otherwise, how do you guarantee that
| "p" still contains the value stored?
Good question. :-)
CodeSourcery, LLC http://www.codesourcery.com