Putting cyrus-future code in CVS. Also, code style

Patrick Goetz pgoetz at mail.utexas.edu
Tue Jun 29 13:37:32 EDT 2010


Wesley Craig wrote:
>> * braces are optional if meaning is clear
>>   if (foo)
>>     function();
>>   else
>>     other_function();
> 
> Personally, I always include the brace, with the exception of
> one-liners, e.g.:
>

Perl requires the use of braces no matter what, and after years of
coding perl and then coming back to C, it's very obvious that this is an
eminently sensible requirement.


> 
>> * goto is permitted within a function only
> 
> As opposed to long jump?  My rule for thumb for goto's is:
> 
>     1) to the end of a function for cleanup
>     2) occasionally, to the top of a loop, but only if using another
> control structure is *less* clear
> 
>> Anything else anyone want to add?
> 

I can't think of a single instance where I've ever needed to use a goto
save for breaking out of multiple loops using a label.  Any other use
probably indicates that the code logic needs to be thought out a little
better.


More information about the Cyrus-devel mailing list