From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5256 invoked by alias); 18 Nov 2004 09:21:17 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 5182 invoked from network); 18 Nov 2004 09:21:08 -0000 Received: from unknown (HELO smtp1.libero.it) (193.70.192.51) by sourceware.org with SMTP; 18 Nov 2004 09:21:08 -0000 Received: from localhost (172.16.1.79) by smtp1.libero.it (7.0.027-DD01) id 40C7315F022F386F; Thu, 18 Nov 2004 10:21:19 +0100 Received: from [151.41.184.47] (151.41.184.47) by smtp0.libero.it (7.0.027-DD01) id 40CB280C0628F036; Thu, 18 Nov 2004 10:21:03 +0100 Received: from 127.0.0.1 (AVG SMTP 7.0.289 [265.3.1]); Thu, 18 Nov 2004 10:23:13 +0100 Message-ID: <0f9b01c4cd50$3a495a20$2fb82997@bagio> From: "Giovanni Bajo" To: "Matt Austern" Cc: References: <8AD5AEEF-3914-11D9-8BD2-000A95BCF344@apple.com> <78169FF3-3916-11D9-AEB4-000A95D692F4@physics.uc.edu> <4D2CF60C-3919-11D9-8BD2-000A95BCF344@apple.com> <20041117212847.A26376@synopsys.com> <68A0DBA9-3923-11D9-8BD2-000A95BCF344@apple.com> Subject: Re: generalized lvalues Date: Thu, 18 Nov 2004 13:17:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at libero.it serv1 X-SW-Source: 2004-11/txt/msg00620.txt.bz2 Matt Austern wrote: > I take the pessimistic view that there are lots > of programmers who have no idea what the language definition is for > the language they're using, but just throw code at the compiler until > the compiler produces an executable that seems to work. That is surely true. > So I think > there may be some people who are using the cast-as-lvalue > extension even if they don't know what a cast or an lvalue is. Sure. Lately, I have been asked help to upgrade an existing C++ codebase from 2.95 to 3.4. I addressed the guys (which have no advanced C++ knowledge at all, let alone standard terms understanding) to changes.html for that release, and that allowed them to fix all the problems *but* this line: int x; [....] (short)x = a; What they actually wanted to do is "x = (short)a", but they could not come up with this trivial fix by themselves. Notice that changes.html mention this issue but does not suggest how to fix this bug (not even in such a trivial case). The other half of the problem is that our error message is: lvalue.cc:5: error: non-lvalue in assignment which requires knowledge of what a lvalue is. And whatever we may think, they do not teach that in C++ 101. If you want to pursue a small task to ease the removal of this feature, I suggest you to prepare a patch against the C/C++ frontend to simplify the text of the diagnostic, and one against changes.html to simplify the wording (maybe explaining in 3 words what a lvalue is) and suggesting some possible solution. Giovanni Bajo