From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16000 invoked by alias); 23 Nov 2004 15:31:40 -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 15819 invoked from network); 23 Nov 2004 15:31:28 -0000 Received: from unknown (HELO mail-out4.apple.com) (17.254.13.23) by sourceware.org with SMTP; 23 Nov 2004 15:31:28 -0000 Received: from mailgate2.apple.com (a17-128-100-204.apple.com [17.128.100.204]) by mail-out4.apple.com (8.12.11/8.12.11) with ESMTP id iANFcKsc001904 for ; Tue, 23 Nov 2004 07:38:20 -0800 (PST) Received: from relay1.apple.com (relay1.apple.com) by mailgate2.apple.com (Content Technologies SMTPRS 4.3.14) with ESMTP id for ; Tue, 23 Nov 2004 07:31:28 -0800 Received: from [10.0.1.3] ([17.219.158.86]) by relay1.apple.com (8.12.11/8.12.11) with ESMTP id iANFVK8b007572; Tue, 23 Nov 2004 07:31:21 -0800 (PST) In-Reply-To: <4D0584E2-3D61-11D9-AEB4-000A95D692F4@physics.uc.edu> References: <4D2CF60C-3919-11D9-8BD2-000A95BCF344@apple.com> <20041117212847.A26376@synopsys.com> <6F5FC748-7BBD-44B9-8DDC-246949F16102@apple.com> <20041118102741.A8347@synopsys.com> <77E8D36A-C0C2-4B03-964C-BEE0FE7BBBC3@apple.com> <98C86CD4-39E2-11D9-B2D5-000A95BCF344@apple.com> <20041119170011.A30410@synopsys.com> <9E6AD708-3A93-11D9-9070-000D9330C50E@apple.com> <20041119174042.A1311@synopsys.com> <90DC5074-3A96-11D9-9070-000D9330C50E@apple.com> <9CD04F70-3CC6-11D9-B847-000D9330C50E@apple.com> <41A253A2.1050205@codesourcery.com> <24BB97A2-3CD3-11D9-B847-000D9330C50E@apple.com> <41A30346.8050602@codesourcery.com> <4D0584E2-3D61-11D9-AEB4-000A95D692F4@physics.uc.edu> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: gcc mailing list , Michael Matz , Matt Austern , Daniel Berlin , Ziemowit Laski , Nathan Sidwell , Joe Buck , Mike Stump From: Steve Naroff Subject: Re: generalized lvalues -- patch outline Date: Tue, 23 Nov 2004 15:50:00 -0000 To: Andrew Pinski X-SW-Source: 2004-11/txt/msg00814.txt.bz2 On Nov 23, 2004, at 7:06 AM, Andrew Pinski wrote: > > On Nov 23, 2004, at 9:56 AM, Michael Matz wrote: > >> Hi,Practically speaking 4.0 is currently strictly less usefull in some >> aspects for the average C programmer. > > The average C programmer would not have thought to use this extension > unless they just decided one day to try it or they actually read the > gcc documentation (which I know almost nobody does). I believe this is true, however some programmers end up using gcc extensions without knowing they are extensions (e.g. variable length arrays, non-constant initializers, etc.). This happens for the same reason you cite - many programmers don't study the language standard (or compile with the strict ANSI modes). Since many of the extensions don't add any new syntax, it is easy to become dependent on these features without realizing it. Like you, I'd love to see this feature removed. Unfortunately, I am concerned about breaking code. Language features are like API's...they are part of the contract we make with our developers. Years ago, I felt inclined to disable all gcc extensions for Apple's compiler. I didn't do it because I knew there would be fallout. Unfortunately, this is a great example of why the thought crossed my mind... btw...I contacted Andreas Hommel (author of the CW C++ front-end). He added generalized lvalue support for gcc compatibility (though they appear to get the right answer for the cases I've been forwarded, whereas gcc doesn't). He has no affinity for the feature and would consider removing it...he has the same concern as I just described...breaking code. > (We keep getting > bug reports about invalid C++ which explicitly added to the changes > page and in the bug section of the documentation but those people > seems not bothered to read those places.) > > if you had the following: > > ((int*)a)++; > > the better idea would be: > > char *a1 = (char*)a; > a1 += sizeof(int)/sizeof(char); > a = (typeof(a))(a1); > > -- Pinski >