Originally posted by Dick Summerfield:
...
So I'm happy to continue using the block indent style but I would be interested to know what the advantages of K&R style are, and which presumably I've missed?
Having a coding convention and sticking with it company wide is much more important than the particular style you choose. Experienced developers should be able to adapt quickly to either style.
That being said, I personally prefer the K&R style for three reasons.
1.) I'm used to it.
2.) Matching braces generates a lot more whitespace which causes developers
to have to scroll around the file more to read it, buring the brain's
CPU cycles in the process. The extra white
space also makes lines of related code, grouped like paragraphs,
separated with whitespace less prominent.
3.) It embeds the line of code to which the braces belong to the block of
code itself which helps avoid typos like this:
There is merit to both and a developer should be able to submit work to the company or school in a format that matches the convention of that institution.