Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262525AbUCJIVf (ORCPT ); Wed, 10 Mar 2004 03:21:35 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262528AbUCJIVf (ORCPT ); Wed, 10 Mar 2004 03:21:35 -0500 Received: from gdr.net1.nerim.net ([62.212.99.186]:31562 "EHLO uniton.integrable-solutions.net") by vger.kernel.org with ESMTP id S262525AbUCJIVc (ORCPT ); Wed, 10 Mar 2004 03:21:32 -0500 To: Richard Henderson Cc: Linus Torvalds , Thomas Schlichter , Andrew Morton , linux-kernel@vger.kernel.org, gcc@gcc.gnu.org Subject: Re: [PATCH] fix warning about duplicate 'const' References: <200403090043.21043.thomas.schlichter@web.de> <20040308161410.49127bdf.akpm@osdl.org> <200403090217.40867.thomas.schlichter@web.de> <20040310054918.GB4068@twiddle.net> From: Gabriel Dos Reis In-Reply-To: <20040310054918.GB4068@twiddle.net> Organization: Integrable Solutions Date: 10 Mar 2004 09:10:49 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1271 Lines: 32 Richard Henderson writes: | On Mon, Mar 08, 2004 at 05:32:11PM -0800, Linus Torvalds wrote: | > Also, I'm not convinced this isn't a gcc regression. It would be stupid to | > "fix" something that makes old gcc's complain, when they may be doing the | > right thing. | | Problem is, that we're supposed to complain for | | const const int x; | and | typedef const int t; | const t x; If I can help with an existing pratice, in C++ the former is invalid and the second is valid -- the extra const is just silently ignored. Therefore, in C++ land the construct | const int a; | const __typeof(a) x; would be accepted because __typeof__ acts like an unnamed typedef[*]. (And in effect, g++ will accept the code -- assuming you abstract over initializers). So, it does not look like an innovation here. I don't know whether this should be another case for "C is different from C++". [*] Yes, an alias that does not introduce a name is strange alias, but that is what __typeof__ does. -- Gaby - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/