Off Topic > Off Topic
Programming Megathread
Ravencroft·:
Idk why you wouldn't have them on individual lines. It looks so much neater and its easier to find stuff.
Otis Da HousKat:
The brackets on a new line is at least part of the style used in K&R, although even within that it varies.
That said I find code that doesn't have opening braces of functions and control statements on the same line and the closing brace at the same indentation to be much harder to read and understand. I feel like having the brackets on their own line is a waste of white space and needlessly spreads code off screen.
Foxscotch:
--- Quote from: SetGaming on May 10, 2016, 08:20:19 PM ---Wow, sorry about that. I've never seen anyone purposely put braces on the next line!
--- End quote ---
I see it a ton in blockland code. I don't like it at all, myself. it makes it look like it's a separate thing from the statement above, to me
SetGaming:
--- Quote from: McJob on May 10, 2016, 09:48:09 PM ---It's in every programming book, tutorial, course and friend's code I look at. Hell, Harvard use it in CS50, and I've looked at AAA game code which used the standard brace style.
--- End quote ---
Jeez, looks like I've been living in the secluded part of programming lmao
St. Francis Xavier:
--- Quote from: SetGaming on May 10, 2016, 08:20:19 PM ---Wow, sorry about that. I've never seen anyone purposely put braces on the next line!
--- End quote ---
It looks fine as long as the indention is kept, if they are not indented properly it looks absolutely horrific