Omitting extra braces is a boon
Posted Jun 10, 2008 21:56 UTC (Tue) by jreiser
In reply to: C89 includes blocks you know...
Parent article: Implications of pure and constant functions
C99 allows to omit the extra braces, but that's about it.
Allowing the braces to be omitted is a significant advantage. It's some syntactic sugar that is really worth it. The combination of requiring braces and coding style conventions can cause swift migration towards the right margin. This impedes readability. I favor placing declarations so as to include the smallest possible span of lines; this eases maintenance by clearly delimiting dataflow. If I must surround every new group of declarations with braces, then the code is often two or three indentations farther to the right. Either that, or I "cheat" on the indentation rules, by placing the braces farther to the left so as to keep the same indentation for the statements which use the new variables.
to post comments)