[Freeipa-devel] Proposed modification to C coding standard

Simo Sorce ssorce at redhat.com
Fri Jul 24 19:08:51 UTC 2009


On Fri, 2009-07-24 at 14:57 -0400, John Dennis wrote:
> Our coding standards highly recommended *not* using braces following a 
> conditional when there is a single expression
> 
> http://freeipa.com/page/Coding_Style#Conditions_and_Statements
> 
> I propose to amend this so that it is highly recommended to always use 
> braces.
> 
> Discussion:
> 
> By not using braces to form a block there is an opportunity to introduce 
> a bug if a programmer adds another expression and fails to notice braces 
> are now needed to preserve program logic. Always using braces is simple 
> defensive programming practice and is recommended by many coding 
> standards. Practical experience has shown the failure to introduce 
> braces when none were there previously is a common mistake which 
> introduces bugs often not found until much later, this can be eliminated 
> by always using braces, readability is not compromised.

+1

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York




More information about the Freeipa-devel mailing list