Joseph S. Myers wrote:
> On Wed, 29 Apr 2009, Manuel López-Ibáñez wrote:
>
>   
>> 2009/4/29 Joseph S. Myers <jos...@codesourcery.com>:
>>     
>>> 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.
>>     
>
> I don't know the rationale for this warning.  Is it to do with the C++0x 
> specification that certain loops may be assumed to terminate?
>   
I think the rationale is to capture this mistake:

for(...);
{
}

Microsoft's compiler has a similar warning, but stricter: it doesn't
care about whitespace, and the only way to get a warning-free empty loop
is to give it an empty compound statement as the body.
So MSC will warn about this construct, but GCC will not, due to its
whitespace rule:
for(...)
  ;

Sebastian

Reply via email to