This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ extension "cast-as-lvalues": time to deprecate?
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: "Giovanni Bajo" <giovannibajo at libero dot it>
- Cc: <gcc at gcc dot gnu dot org>
- Date: 09 May 2003 08:54:25 +0200
- Subject: Re: C++ extension "cast-as-lvalues": time to deprecate?
- Organization: Integrable Solutions
- References: <3b6301c315bd$194a7c60$114e2697@bagio>
"Giovanni Bajo" <giovannibajo@libero.it> writes:
| Hello,
|
| GCC implements an extension which lets cast result be a lvalue instead of a
| rvalue, as would be prescribed by the standard. There are several open PRs
| about problems with this extension, some of which are very tricky and
| involves also wrong-code problems (together with inliner, for instance).
| Just for reference, you may want to check:
|
| http://gcc.gnu.org/PR?1833
| http://gcc.gnu.org/PR?1920
| http://gcc.gnu.org/PR?7503
| http://gcc.gnu.org/PR?7884
|
| Other PRs have been closed already as duplicates.
|
| I think there are no doubts that this extension causes confusion among
| users, because the behaviour is not expected. Plus, bugs in its
| implementation causes very bad side effects. If this was not enough, the
| extension is active even in -ansi -pedantic mode, which is counter intuive
| and confusing. Since GCC already deprecated and removed less evil extensions
| like implicit typename, I wonder if maybe it's time to deprecate this
| "cast-as-lvalue" and remove it as soon as possible.
IIRC, this has been discussed in the past with no definitive
conclusion but deprecation and removal were on good track.
Some patches have been applied in the past to correct cases where it was
causing us to reject valid codes.
This extension is an examplar of extensions that were not given enough
thought and are causing much more trouble than they do useful things.
This extension in particular is not needed nor useful in C++ because
they are far better alternatives. It is pointless.
It should simply be removed.
-- Gaby