4 ms·
I've actually evolved a hybrid style in my personal projects - next line for functions/classes, same line for blocks. To me, it looks weird when functions don'
by DanHulton 9y ago
I've actually evolved a hybrid style in my personal projects - next line for functions/classes, same line for blocks.
To me, it looks weird when functions don't have that extra line of space to set off their definition, but if/while/whatever aren't special enough to need that call out.
That said, the most important factor is simple consistency. In my person projects, I have the hybrid style. At work, I use same-line-only. If I'm on a project that has next-line, we all use next-line.
- nitrogen 9y agoI think the Linux kernel style is similar. That was the first coding standard I somewhat adopted, but naturally have adapted to many others on different teams over time.
- erik_seaberg 9y agoI think this style dates back to K&R C where you (maybe) declared argument types after the parens. int max(a, b) double a, b; { return a > b ? a : b; }