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

Joe Buck jbuck@synopsys.com
Fri May 9 17:15:00 GMT 2003


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.



More information about the Gcc mailing list