-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/24/2009 02:57 PM, 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. >
I concur (and have mostly been ignoring the previous policy up to this point). The only comment I might make is that it may still be acceptable for true single-line if statements, e.g. str = malloc(10); if(!str) return ENOMEM; - -- Stephen Gallagher RHCE 804006346421761 Looking to carve out IT costs? www.redhat.com/carveoutcosts/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAkpqBaEACgkQeiVVYja6o6P5ugCffuMYmQovLieM8+VF7vEbLvpa 1C4An2gC+tkN89YRxi5C/f30iVxi1Bnd =Cx9g -----END PGP SIGNATURE----- _______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel