Re: m68k gcc/egcs question

Zalman Stern <zalman@netcom12.netcom.com>
3 Oct 1999 03:28:15 -0400

          From comp.compilers

Related articles
m68k gcc/egcs question zoltan@bendor.com.au (Zoltan Kocsi) (1999-09-20)
Re: m68k gcc/egcs question davidwilliams@ozemail.com.au (David Williams) (1999-09-24)
Re: m68k gcc/egcs question mrs@kithrup.com (1999-09-24)
Re: m68k gcc/egcs question jejones@microware.com (James Jones) (1999-09-27)
Re: m68k gcc/egcs question albert@korppi.cs.tut.fi (1999-09-28)
Re: m68k gcc/egcs question zalman@netcom3.netcom.com (Zalman Stern) (1999-10-01)
Re: m68k gcc/egcs question zoltan@bendor.com.au (Zoltan Kocsi) (1999-10-01)
Re: m68k gcc/egcs question zalman@netcom12.netcom.com (Zalman Stern) (1999-10-03)
Re: m68k gcc/egcs question graham@barnowl.demon.co.uk (Graham Murray) (1999-10-03)
| List of all articles for this month |

From: Zalman Stern <zalman@netcom12.netcom.com>
Newsgroups: comp.sys.m68k,comp.compilers
Date: 3 Oct 1999 03:28:15 -0400
Organization: Netcom
References: 99-09-078 99-09-103 99-10-005
Keywords: C++, standards

In comp.compilers Zoltan Kocsi <zoltan@bendor.com.au> wrote:
: mrs@kithrup.com (Mike Stump) writes:
[...]
:> Let me quote from ANSI C++:
:>
:> 5.17 Assignment operators [expr.ass]
:>
:> 1 There are several assignment operators, all of which group right-to-
:> left. All require a modifiable lvalue as their left operand, and the
:> type of an assignment expression is that of its left operand.


: So far it is simple and clear.


:> 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.


: As you have stated, it says that the result is an lvalue, therefore it
: must be a reference to the left hand storage rather than its content
: directly.


As I said in my previous post, the above is not true in Standard
C++. It is subject to interpretation, but if the C++ committee meant
for the result to always be a reference to the left hand storage they
would have said so. They didn't and there is a fair bit of agreement
that if the compiler had to generate a temporary to do the assigment
then that temporary can be returned as the lvalue. (There is less
agreement about what happenes if no temporary is generated, but the
language is pretty clear that the compiler just has to guarantee you
get *some* lvalue that has the right type and the right value.)


As to the rest of Zoltan's post, its not clear that the difference
between C89/C9X and Standard C++ is properly appreciated. Assignment
behaves somewhat differently in the two languages as in C++ the result
of an assignment is an lvalue and in C it is not.


-Z-
[Followups to comp.std.c or comp.std.c++ please, this has wandered off
the topic of compiler construction. -John]





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.