[lkml]   [2004]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] fix warning about duplicate 'const'
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
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:01    [W:0.082 / U:4.100 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site