>K&R
>Stroustrup
>Linux
>Allman/BSD
>GNU
>Horstmann
What's your favorite indentation style Jow Forums?
Indentation Style
whatever is in .clang-format
now kys for asking shitty questions
>Allman/BSD
I don't know why this is a thing
almost everything uses KNF, even in userspace
K&R
K&R
gimme a quick rundown on all that shit
Make a poll.
Write in allman. Commit in Linux.
Thanks clang format hooks.
K&R
while (x == y) {
dofoo();
eatbar();
}
Stroustrup and Linux style are similar to K&R style
Allman/BSD
while (x == y)
{
dofoo();
eatbar();
}
GNU Style
while (x == y)
{
dofoo ();
eatbar ();
}
Horstmann
while (x == y)
{ dofoo ();
eatbar ();
}
Whitesmiths (forgot to mention it)
while (x == y)
{
dofoo();
eatbar();
}
only K&R and BSD styles are sane
others are for special snowflakes
>Horstmann
Ew, what the fuck?
Python
#include
int main(int argc, char **argv) {
while (x == y) {
dofoo ();
eatbar (); }
return 7;
}
Python
fuck....now it should work.
#include
int main(int argc, char **argv) {
while (x == y) {
dofoo ();
eatbar (); }
return 7;
}
K&R
also tabs for indentation, spaces for alignment
Thanks for this user.
I switched to Allman/BSD. Found it easier to copy/paste blocks of code. So I think I'll stick with it.
K&R just feels right
I saw another one in uni some years ago
while (x == y)
{
foo();
if (x < z)
{
bar();
}
}
Forgot code tags
while (x == y)
{
foo();
if (x < z)
{
bar();
}
}
Was how it looked like.
void foo(int arg) {
if (lol) return arg+1;
return arg;
}
And one lines:
void foo(int arg) { return lol ? arg+1 : arg; }
*Sorry, forgot to close the code tag.
who cares about code style i mean the compiler doesn't care anyway why waste time lol