From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Richard Henderson <rth@twiddle.net>
Cc: Linus Torvalds <torvalds@osdl.org>,
Thomas Schlichter <thomas.schlichter@web.de>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, gcc@gcc.gnu.org
Subject: Re: [PATCH] fix warning about duplicate 'const'
Date: 10 Mar 2004 09:10:49 +0100 [thread overview]
Message-ID: <m3fzchxgty.fsf@uniton.integrable-solutions.net> (raw)
In-Reply-To: <20040310054918.GB4068@twiddle.net>
Richard Henderson <rth@twiddle.net> 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
next prev parent reply other threads:[~2004-03-10 8:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-08 23:43 [PATCH] fix warning about duplicate 'const' Thomas Schlichter
2004-03-09 0:14 ` Andrew Morton
2004-03-09 0:32 ` Linus Torvalds
2004-03-09 1:17 ` Thomas Schlichter
2004-03-09 1:32 ` Linus Torvalds
2004-03-09 1:35 ` Linus Torvalds
2004-03-10 4:08 ` Keith Duthie
[not found] ` <20040310054918.GB4068@twiddle.net>
2004-03-10 8:10 ` Gabriel Dos Reis [this message]
[not found] ` <20040310064001.GA7584@daikokuya.co.uk>
2004-03-10 10:15 ` Joseph S. Myers
2004-03-10 15:43 ` Linus Torvalds
2004-03-10 18:22 ` Richard Henderson
2004-03-10 18:29 ` Andrew Haley
2004-03-10 18:35 ` Paul Koning
2004-03-10 18:37 ` Richard Henderson
2004-03-16 1:46 ` Mike Stump
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3fzchxgty.fsf@uniton.integrable-solutions.net \
--to=gdr@integrable-solutions.net \
--cc=akpm@osdl.org \
--cc=gcc@gcc.gnu.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rth@twiddle.net \
--cc=thomas.schlichter@web.de \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.