🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1051

Re: Assignment operators return lvalues / classes and types

#1051
From: Scott Layson Burson
Date: Sun, 28 Apr 1991 01:18
33 lines
2045 bytes
In article <1991Apr25.030006.5849@csi.uottawa.ca> hitz@sim5.csi.uottawa.ca (Martin Hitz) writes:
>In article <1991Apr24.184018.23427@kestrel.edu> gyro@kestrel.edu (Scott Layson Burson) writes:
>>In article <950@edg1.UUCP> jsa@edg1.UUCP (J. Stephen Adamczyk) writes:
>>>The ARM (5.1.7) says that the value of an assignment operator is
>>>an lvalue.  That's different than ANSI C (3.3.16).  There must
>>>be a reason for the difference; can anyone enlighten me?
>>
>>I surmise, without really knowing, that people want to write things
>>like `(a = b).foo', for which it is required that the assignment
>>return an lvalue.
>
>No. Consider the following program:
> [deleted]
>
>f() does NOT return an lvalue, the last line in the program is therefore
>illegal. However, f().i is of course allowed, and so would be (a = b).foo, 
>even if = didn't return an lvalue.

Oops, I meant to say `(a = b).foo()'.  As I read E&S, this would still
be legal if assignment returned an rvalue, but would mean something
different: where the current meaning is the same as `(a = b, a.foo())' ,
if assignment returned an rvalue, it would be more like

    T temp = (a = b);
    temp.foo();

However, I can't completely convince myself that this analysis is
correct, because while E&S (5.17, p. 79) says that the result of an
assignment is an lvalue, it neglects to say *which* lvalue it is.
This seems like a lacuna in the specification.

-- Scott
Gyro@Reasoning.COM
Technical Details
Message-ID: <1991Apr28.011823.25875@kestrel.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!usc!ucselx!petunia!kestrel.edu!gyro
References: <950@edg1.UUCP> <1991Apr24.184018.23427@kestrel.edu> <1991Apr25.030006.5849@csi.uottawa.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!usc!ucselx!petunia!kestrel.edu!gyro
From: gyro@kestrel.edu (Scott Layson Burson)
Newsgroups: comp.std.c++
Subject: Re: Assignment operators return lvalues / classes and types
Keywords: assignment, lvalue, class, type
Message-ID: <1991Apr28.011823.25875@kestrel.edu>
Date: 28 Apr 91 01:18:23 GMT
References: <950@edg1.UUCP> <1991Apr24.184018.23427@kestrel.edu> <1991Apr25.030006.5849@csi.uottawa.ca>
Organization: Kestrel Institute, Palo Alto, CA
Lines: 33