r/shittyprogramming • • Apr 23 '19

Space efficient & lines up nicely

Post image
521 Upvotes

58 comments sorted by

View all comments

Show parent comment

6

u/Cathercy Apr 23 '19

Why? K&R style is GOAT.

2

u/[deleted] Apr 23 '19

In my mind it depends on the use-case. If the code I'm editing or the language I'm using favors the second style, I'll use it. However, since I use an inordinate amount of C/C++, it makes more sense for things like struct types, and therefore makes sense to carry over to functions, etc.

If you think of struct { ... } as a type in and of itself (which it is), it makes more sense to write them in multiple lines with the { on the same line as struct. Writing it otherwise, in my mind, makes it look strange, since both struct and the {} are part of the same type. Just my 2¢.