Hacker News new | ask | show | jobs
by scott_s 6196 days ago
I use K&R style for control structures (loops, if/else), but function braces get their own line. Braces for classes, structs and namespaces go on the same line.

I'm not worried about obsessing about compact code; this style just looks best to me. I'm consistent with my formatting, so I can glance at my code and know what I'm looking at. Actually, I can literally unfocus my eyes and I still know if I'm looking at a function, control structure within a function, or a class definition.

The important part, where taste comes in, is where code gets separated by empty lines. I consider code separated by empty lines akin to paragraphs.

For the reocrd, my indent settings:

  -br -brs -nbfda -npsl -npcs