This is the mail archive of the
mailing list for the GCC project.
Re: generalized lvalues
- From: Fariborz Jahanian <fjahanian at apple dot com>
- To: Matt Austern <austern at apple dot com>
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Thu, 18 Nov 2004 08:18:50 -0800
- Subject: Re: generalized lvalues
- References: <8AD5AEEF-3914-11D9-8BD2-000A95BCF344@apple.com>
What was the rational to have this extension in the first place. Maybe
we sould dig this out before
declaring that it was a 'bad idea'.
On Nov 17, 2004, at 7:47 PM, Matt Austern wrote:
Could somebody remind me, please, of the reasons we removed
generalized lvalues? I know there were several reasons, but I'm not
sure if I've ever seen a complete list. Here are the reasons I can
reconstruct from memory:
1. It broke valid C++ programs. If we overload a function on
constness, like foo(int&) and foo(const int&), then invoking it as
foo((int) x) is required to call the const version. Generalized
lvalues made us choose the latter.
2. It was underspecified. There were cases, again especially in C++
in the presence of operator overloading, where nobody was quite sure
either what it did or what it was supposed to do.
3. I have the vague sense that it caused back end bugs, but I can't
find them offhand.
Anything else? (Incidentally, I think all of these apply to
cast-as-lvalue. I haven't heard of any problems caused by
conditional-as-lvalue or comma-expression-as-lvalue.)
The reason I'm asking: I think some people are going to find the
removal a nasty surprise. Yes, it was deprecated in 3.3.x and 3.4.x,
but not everyone upgrades to the latest release of older branches. I
imagine some people won't have noticed the discussion about removal
until they upgrade to 4.0 and see that it's gone. At that point we'll
have three choices: convince them that removing it made the compiler
better, or reconsider and put it back, or refuse to put it back, don't
tell anyone why it's gone, and live with unhappy users who think we're
stupid and capricious. If we want to go with one of the first two
options, it'll help to have a collection of reasons.