Agreed. I'm pretty fond of this style myself too. The first one doesn't really bother me but I think the last one is a bit too cramped to read it easily. I also don't know why people like to use Java-style braces:
I've never liked this way of doing things. Especially with the whole tab/space debate (it doesn't matter which one you're using), it is very nice to have a new-line for this kind of statement because this way the braces will be on exactly the same indentation level. This makes it easier to see what ends where.
The first style is actually K&R style. It only becomes Java style when you do the same after function definitions.
As for why I don't do it: I spot the depth of the code by it's indentation level, rather than that of the surrounding braces, and putting the { on the same line as the condition saves vertical space (Which means I can look at more code at once without it becoming cramped)
Owen wrote:The first style is actually K&R style. It only becomes Java style when you do the same after function definitions.
As for why I don't do it: I spot the depth of the code by it's indentation level, rather than that of the surrounding braces, and putting the { on the same line as the condition saves vertical space (Which means I can look at more code at once without it becoming cramped)
I used to do what you're calling "Java style" (I've never used Java, so I wouldn't know) but I decided K&R/1TBS is more readable. Originally I used ANSI/Allman style, though.
What matters more to me is the presence of comments, documentation, designs and readable names. I have the tendency to just copy over the formatting when working on existing code.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Combuster wrote:For the record, I'll just go for the ANSI +1
What matters more to me is the presence of comments, documentation, designs and readable names. I have the tendency to just copy over the formatting when working on existing code.
I agree there. I only reformat code when the original style is unreadable.
I do tend to miss things like spaces before parentheses though; for projects which do that and I haven't noticed, I tend to get the patch tossed back at me till I fix that
when it comes to me, im use to it bein just me readin it, cus im so messy with my work. theres barely ever a space. makes it harder to define the problems.. but it all works out some how in the end
That isn't convenient, it's just annoying. I don't mean to be rude, but I don't want to have to scroll through all that text I'm not going to read just to read the posts below. Could you remove it, please? The link is fine.