Re: returning lvalue in C vs C++
- From: "Alf P. Steinbach" <alfps@xxxxxxxx>
- Date: Sat, 01 Apr 2006 21:13:02 +0200
* Phlip:
Ben C wrote:
My understanding of what was said about the C++ standard was that
f().operator=(42) should work, but that f().x = 42 shouldn't! On the
basis that f() is an rvalue (so they say...), and a method call on an
rvalue is OK, but an rvalue on the lhs of an assignment is not.
But I thought that the expression rvalue.x makes x an lvalue, because The Standard didn't say that rvalue.x must be an rvalue. (I'm not reading the Standard here - I just picked that up from this thread.)
The standard does (implicitly) say that rvalue.x must be an rvalue, in §5.5.5/4, "If E1 is an lvalue, then E1.E2 is an lvalue".
However, I have CHANGED MY STANCE on when assignment is allowed: I now think the standard is too unclear for a straight answer such as the one I gave, which, as I see it know, may even be considered /incorrect/.
Much of the problem is that any other interpretation than the one I gave, seems to yield inconsistencies.
Consequently I've posted the question to [comp.std.c++].
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
.
- References:
- Re: returning lvalue in C vs C++
- From: Phlip
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Phlip
- Re: returning lvalue in C vs C++
- Prev by Date: Re: returning lvalue in C vs C++
- Next by Date: Implementation of Trees
- Previous by thread: Re: returning lvalue in C vs C++
- Next by thread: Implementation of Trees
- Index(es):
Relevant Pages
|