[Scummvm-devel] Coding convention for empty while body?

Max Horn max at quendi.de
Sun Apr 4 10:17:53 CEST 2010


Am 03.04.2010 um 00:55 schrieb Johannes Schickel:

> Thierry Crozat wrote:
>> 
>> I looked at the coding convention page of the wiki and found no  
>> convention about this. Should we for example fix the convention to  
>> using braces?
>> while (condition) {}
>> 
>> In my opinion that makes it more clear that it was intentional to  
>> have an empty while body. That would also removes the warnings.
>> 
> 
> Personally I think that is fine, though IMHO this would be fine too:
> 
> while (...)
> <tab>;
> 
> Though in both cases I would be in favor of a comment explaining why 
> there's an empty body :-).

Indeed, and this should be part of the CFC. So, it should be:
  while (...) ;   // Skip over BLA BLA with an empty loop
or
  while (...)
     ;    // this loop is intentionally empty
(the latter is OK if it is obvious from context why the loop is empty).

Feel free to augment the CFC page accordingly :)


Cheers,
Max




More information about the Scummvm-devel mailing list