2009/4/29 Joseph S. Myers <[email protected]>:
> On Wed, 29 Apr 2009, Ian Lance Taylor wrote:
>
>> * The C++ frontend warns about "while (true);" when there is no
>> whitespace between the ')' and the ';'. The C frontend does not. I'm
>> not sure how to best handle this. It doesn't make much sense to warn
>> about this with -Wc++-compat. Should the C frontend warn about this?
>> Should the C++ frontend not warn about this? Any opinions?
>
> I consider this whitespace-sensitive warning very dubious.
So would you like it if it were not sensitive to whitespace?
(It could be silenced by while(true) (void)0;)
I think the point is more whether the warning itself is useful or not.
>
>> * In C a const variable which is neither "extern" nor "static" is
>> visible outside of the current translation unit. In C++ it is not,
>> without an explicit "extern" declaration. I'm not sure how best to
>> handle this with -Wc++-compat, since C does not permit initializing an
>> "extern const" variable.
>
> C does permit it; there's a warning, not a pedwarn. Add an option to
> disable this warning (at least where "const" is used)?
In any case, -Wc++-compat should warn about the difference in
behaviour, shouldn't it?
I see the current code already handles this somehow:
/* It is fine to have 'extern const' when compiling at C
and C++ intersection. */
if (!(warn_cxx_compat && constp))
warning (0, "%qs initialized and declared %<extern%>", name);
BTW, why is this warned about?
Cheers,
Manuel.