I prefer the first style, because it takes up less of my precious vertical real estate. However, since visual studio by default uses the second style for C#, I'm using that now. Doesn't matter too much. Now if you wrote:
I've always been a proponent of spacing out code as much as possible. Whitespace doesn't cost anything, so I say use it liberally for make benefit readers of your code.
I use the first style. (I pretty much follow Mozilla's coding conventions. My first exposure to braces and almost all the C++ I've written has been in Mozilla source code.)
Whitespace isn't free, btw. Judicious use of whitespace is important, but excessive whitespace cuts down on how many lines of code will fit on my screen. You can lose a lot of context lines if you put an extra line break in every single if/else/loop statement.
The most important whitespace issue for debugging is proper (and consistent) indentation, though. A compiler will catch a missing opening brace, but it won't tell you if statements are in the wrong block.
Comments 5
for(int i=0;i<10;i++) {
}
I'd be annoyed. :)
Reply
Reply
there are other types of nerd in this world?! whoa.
Reply
But you're cool, I like you. =)
Reply
Whitespace isn't free, btw. Judicious use of whitespace is important, but excessive whitespace cuts down on how many lines of code will fit on my screen. You can lose a lot of context lines if you put an extra line break in every single if/else/loop statement.
The most important whitespace issue for debugging is proper (and consistent) indentation, though. A compiler will catch a missing opening brace, but it won't tell you if statements are in the wrong block.
Reply
Leave a comment