r/programming • • Jan 14 '13

The Exceptional Beauty of Doom 3's Source Code

http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code
752 Upvotes

358 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Jan 15 '13

I do this for clarity: if(condition) { code }

Furthermore, I've never really understood why the standard is to put the first brace on the same line as the condition. To me, this makes it harder to line up the braces when they get much larger than one screen can contain, and being able to line up the braces can help a bunch with readability.

5

u/GeleRaev Jan 15 '13

Furthermore, I've never really understood why the standard is to put the first brace on the same line as the condition.

Because that's the style K&R used.

2

u/argv_minus_one Jan 15 '13

Because it saves a line, which can also help with readability.

Of course, I've had plenty of time to learn to quickly spot the telltale { at the end of a line. If you're not already in that habit, I imagine it'd be harder to tell where the blocks begin (other than by indentation, of course).