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
-
muma2816y@gintko realistically how many lines of code can one really see? Also: Vertical mode is a thing for screens nowadays. And all that nice amount of code is totally useless if you have to remember yourself which bracket is used where.
-
muma2816y@gintko compare the K&R style with the Whitesmiths style: Using the Whitesmiths style i can look at the code and see the structure at a glance, independently of the tool i use. It is clearly obvious just from looking at it. Personally i think it is also more visually pleasing, but that is up to taste.
Python is a completely different topic. I really like that python has minimized the usage of brackets, especially for the if, for, while and def keywords. It is the most pleasing of all, and intendation works perfectly there -
aul122416y@RantSomeWhere for functions K&R have the opening bracket on the next line, for everything else on the same line. Their reasoning is that functions are special because they can't be nested (at least in c).
-
tokumei21256yNo, K&R sucks because it lets you omit braces from if blocks with single statements. Coming from Rust, where OTB is common (and braces are required by the language syntax for control flow statements), it is definitely a superior variant of K&R.
Oh, and function definitions that can ergonomically span multiple lines because of the return type being after the parameters:
fn name<T>(params)
-> returns
where
T: FromStr,
{ ... }
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
-
sam966911Hats off to this lady .... I would have just flipped the machine
K&R style Brackets are so goddamn shitty. I hate hate hate hate that style. It makes code so goddamn hard to read. And for what gain? You write "less" lines of code? So what? Who gives five fucks about that? Readability is key for coders.
rant
brackets
k&r style
c++