Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
In C/CPP I've often seen
keyword
{
...
}
While I've seen
keyword {
...
}
In most other languages. -
Root825385ySame line.
Fewer empty lines to mentally discard that way.
Programming involves much more reading than writing, so your focus should be on making it is easy to read as possible. Anything that increases the mental effort required to read the code should be avoided. Poor alignment, extra lines, inconsistent styling, unnecessary complexity, poor line length, unnecessary chaining, too long or short names, etc. If it isn't simple, you're doing it wrong. -
Not same line. I hate it when block delimiters which I just scan over are intermixed with actual statements.
However, if a code base has already Egyptian style brackets, I use that because consistency is more important. -
Personally I've used and liked both. I also like to add empty lines in my code to make it more readable, but I add them the same way one defines paragraphs. Related lines group together, within reason.
I do try to extract longer running, well defined sections into their own function though, reducing the need for spacing.
Related Rants
-
AlgoRythm25Dude chaining in JavaScript is so fucking ugly but so trendy. thing.doStuff().doThing().then().doMoreStuff()....
-
netikras14No, listen to me. I cannot approve this PR because your code does not comply with our code style. All the impo...
-
Coffe2Code7Let's comment out this block of code so later we know we have this feature and bring it back if we need it. L...
Where should starting brackets be positioned if/else and function definition in C? Same line or the next line. Have not seen pure cosmetic bullshit like this.
rant
wk190