This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ extension "cast-as-lvalues": time to deprecate?


Joe Buck <jbuck@synopsys.com> writes:

| On Fri, May 09, 2003 at 08:54:25AM +0200, Gabriel Dos Reis wrote:
| > 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.
| 
| As it has already been deprecated, I agree that it should be removed.
| Because of bad interactions with references, its presence can cause severe
| problems; in particular, it can cause the wrong overloaded function in a
| conforming C++ program to be chosen.  Since it's likely that a non-const
| function will be chosen instead of a const function, severe things can
| happen, like code attempting to change a literal in a read-only section,
| giving a program crash.

Yeah :-(

I would like to add that that extension caused us to reject some
well-formed codes, then Matt Austern submitted a patch (last year IIRC)
that attempted to limit the damages, but then that patch turns out to
reject other valid codes just because of the presence of that
extension :-(

-- Gaby



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]