On Sep 29, 2006, at 4:44 AM, Mat Scales wrote:
Gavin Vess wrote:
.. although the Linux Kernel team does not use braces when there is
only one statement after the conditional. I would prefer we follow
this standard more closely, and eliminate braces around a single
statement. Anyone else have this preference?
Have you really never seen someone introduce a bug into a system
because they added another statement to the conditional and forgot to
put the braces back in? These things don't happen every day, but they
are relatively common and can be difficult to spot. Always having
braces in place eliminates a source of bugs and not doing it doesn't
save much, so for me the choice is easy.
I have seen this bug in a deployed system. IMHO, the more programmers
that work on a given system, the more important it is to always include
the braces.
I prefer the one true brace. My text editor also has a visual
indicator when braces match, so the alignment is not that important to
me. I prefer vertical density.
Now that we've tackled braces, on to tabs versus spaces...
Seriously, the important thing is to have a standard, not so much what
the standard is. (Unless it is really bad.) These standards
discussions always generate heat and friction and not much light.
I generally like the PEAR standard. Is there a reason not to use it?
Why not start with that and say, we conform to the PEAR standard,
except for these exceptions, and here are some additions. Or if you
just can't bring yourself to link to the PEAR standard, at least
re-state it and adopt compatibility as a goal. There is so little to
be gained from creating yet another coding standard.
Best Regards,
Jeff