void foo() {
Is there a reason for this other than "muh K&R"?
Obviouslyvoid bar()
{
is much better
No it doesn't
The second one is K&R style you tard.
>>60600181
>not voiding your functions
wew
>>60600276
https://en.m.wikipedia.org/wiki/Indent_style#K.26R
>>60600181
With today's performance it's only a matter of taste. Just use whatever suits you and looks aesthetic too you.
Unless you're working on someone else's project, in which case use whatever style they prefer.
How to spot a javascript faggotif (cond) {
// ...
}
C++ developer master raceif (cond)
{
// statement
}
orif (cond)
// single statement
>>60600181
For function definitions like your example actually the second is K&R.
There's really no objective reason to use one over the other. Originally there was a reason for the discrepancy, see the wikipedia part right after what >>60601213 linked.
I use same-line brackets for enums, structs, unions and initalizer lists.
Functions use new-line brackets.
And for stuff like loops and control-flow statements, I like to avoid using brackets altogether.
Have you ever written a 5-level for loop guarded with only 1 semicolon?
Or how about a higher order conditional statement that makes heavy use of the return value of the assignment operator?
There is no one superior way. It depends on the spec that the project adheres to.
#include<u.h>
#include<libc.h>
void
main()
{
print("hello,world\n");
exits(0);
}
>>60601213
Yea, the second one is k&r
k&r uses second style for functions (and since you posted a function, the second one is k&r)
k&r uses the first style for if statements, loop, etc