[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Legit question, guys...
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 79
Thread images: 4
File: ABCorD.png (25 KB, 515x372) Image search: [Google]
ABCorD.png
25 KB, 515x372
What's your favorite indent style?
Why it's your favorite?

http://strawpoll.me/7021274

Discuss!
>>
>>53363537

'A' now, 'B' when I was a noob.
>>
>>53363537
A seems good.
B is wasting space and looks retarded.
C is for those who came out of the wrong hole
And D, How these people even know how to breathe ?
>>
>>53363537
We have this thread every fucking day. Most people prefer A, a good amount of people prefer B, and C and D are trolls.

Regardless of your preference, it doesn't actually matter that much and you always match the style of the project you're working on if you didn't start it or don't control its style guide.

Now fuck off
>>
A
D sometimes acceptable e.g. for obvious one liners like getters and setters which don't need to be readable.
>>
A but without a space between ) and {
>>
>>53363633
>without a space between ) and {
Fuck off
>>
>>53363537
int main (int argc, char ** argv)
{
printf ("Hello, world!\n");
return 0;
}
>>
>>53363537
I prefer A myself but I've seen a lot of people who prefer B for some reason.
>>
Who the fuck is spamming C on strawpool ?
>>
>>53363675
>char **argv
Kill thyself.
>>
>>53363698
Richard Stallman
>>
>>53363698
What makes you think it's spam? GNU/Style is the freeest of all indentation styles.
>>
int main (int argc, char ** argv) {
printf ("Hello, world!\n"); return 0;}
>>
B when I started but now A

It's clean, only 4 lines, and most people use it
>>
>>53363722
It looks like shit, that's why.
>>
C and D are just perverse.
>>
>>53363702
why ?
char *argv[] is just stupid.
>>
>>53363633
this
>>
>>53363537
A, though when I stared out I used B quite a bit.

It just ends up increasing line count for no good reason.
>>
>>53363698
>non-captioned strawpoll

when will people learn?
>>
Your options are all shit.
int
foo(int bar)
{
if (bar) {
baz();
}

return botnet(bar);
}


Indention by tabs and tabs are 8 spaces.
>>
>>53363746
An array and a pointer are not the same thing. argv is a pointer to an array of char.
>>
>>53363761
you are a moron.
no one said a pointer and an array are the same thing, but
char **argv is exactly the same as char *argv[] dipshit.
>>
>>53363755
>not
int
foo(int bar) {
if (bar)
{
baz( );
}

return botnet(
bar
);
}
>>
A, the rest are utterly disgusting
>>
>>53363773
Syntactically, yes. Semantically, yes. Pragmatically, no.
>>
>>53363537
B - waste of lines, does not give the best enclose feel
C - waste of lines, gives some enclose feel
D - solves both problems, isn't as readable

A - master race reporting in, solves both problems elegantly
>>
>>53363761
to clarify
theres a difference between
char array[5];
and char array[] = {63, 64, 65, 66, 67};
try a sizeof.. and then kill yourself
>>
>>53363755
Basically this.
Anything other than OpenBSD KNF is trash.
>>
>>53363812
no
>>
>>53363876
Yes
>>
>>53363920
i don't know
>>
>>53363808
sometimes i forget that there are people literally having autism...
>>
>>53363537
B with tabs.
>>
>>53363985
you're the dumb one here honey
>>
>>53363537
A with D being used for single line conditionals and for loops when i want to save space
>>
>>53363537
>strawpoll
>someone already rigged it because lolstrawpoll
absolutely brilliant
>>
B

white space is good
>>
>>53363537
D
Every whitespace character you use just increases the file size and the execution time if you are using an interpreted language
>>
I try to always use A but Visual Studio made me confortable with B.
>>
>>53364107
>hasn't heard of post-process minification
>>
>>53363537
A
but D can be good for one line loops
>>
int main( int argc, char *argv[] ) {
printf( "Hello, world\n" );
return 0;
}
>>
File: 1433191732242.jpg (179 KB, 640x671) Image search: [Google]
1433191732242.jpg
179 KB, 640x671
>>53363537
A or B depending on the language.

For example I use A for Java and B for C#
>>
Fuck it this poll is over.
>>
>>53363537
what color scheme is this?
>>
D
>>
>>53365577
For dubs!
>>
>>53363537
int
main (int argc, char *argv[])
{
//do some stuff
return 0;
}
>>
>>53363537
Everything other than option A is degenerate.
>>
>>53363613
This
>>
>>53363537
why can't everything just be like python?
>>
>>53366409
because not everyone has downs like the python brogrammers
>>
>>53363537
I've always used B, with tabs. That's what was used in MFC, and I got used to it. I find it far easier to read than A.
>>
>>53363843
Strictly speaking, OpenBSD KNF would read
int
foo(int bar)
{
if (bar)
baz();
return (botnet(bar));
}
>>
>>53363613
yep
>>
>>53363537
A: Keeps the code small
B: Good for readability
C: Plain ugly
D: You'll not do well at life
>>
>>53363537
C
Fuck your waste of lines bullshit, it's by far the easiest to read.
>>
>>53366546
I SUCK DICKS. They removed parens after returns from style(9) ~4 months ago without making any effort to remove it from the tree.
>>
>>53363537
>http://strawpoll.me/7021274

B is the only reasonable style, since it highlights the indent in both directions. It is possible to see the block edges both moving back and moving forward in code.

A is acceptable.

C an D are just there to throw us off, right?
>>
Where my đ niggas at ?
>>
>>53363537
The one true brace style. A.
>>
>>53363537
>strawpoll
fuck off asshole
>>
B, it has the best visual separation.
A, in the example, looks alright. However when the function name is long, it creates a blob at the top of every function.

public function save_user_cover_photo( $base_64 ) {
$folder= get_user_uploads_folder( CURRENT_USER_ID );
$upload_path = UPLOAD_DIRECTORY . "/api/{$user_id}/cover_photo/";;

if( ! user_has_cover_photo() ) {
[...]
}
}


vs.

public function save_user_cover_photo( $base_64 )
{
$folder= get_user_uploads_folder( CURRENT_USER_ID );
$upload_path = UPLOAD_DIRECTORY . "/api/{$user_id}/cover_photo/";

if( ! user_has_cover_photo() ){
[...]
}
}


Second one has a much more profound visual impact.
>>
A is my favourite.
What I'm actually using? For new projects, whatever the language specs/official styleguide demands, for existing projects, whatever is already used.

Fuck being a special snowflake.
>>
>>53367034
> spaces around parenthesed arguments
> spaces after unary operators
> PHP
Wow.
>>
>>53363537
A in general, B for readability in some cases, D when possible.

Never C.
>>
>>53367034
This. B is objectively more readable than A and anyone saying
>b-b-but wasted lines
is a faggot for keeping the ending brace on a new line
>>
def main():
print('Hello, world!')
return 0


:^)
>>
>>53363563
This
>>
>>53363537
B
>>
C is objectively the better for indentation purposes and readability.
A is good but no symmetrical .
D is just fuck my shit up familiar. I would admit to use it for short lines only.
>>
>>53364107
>This
Even though it really doesn't matter much most of the time, knowing my code runs as good as possible gives me a warm and fuzzy feeling.
>>
>>53363607
>C is for those who came out of the wrong hole
It's called GNU style
>>
File: 1442631877854.gif (992 KB, 389x259) Image search: [Google]
1442631877854.gif
992 KB, 389x259
>>53367400
kek
>>
>>53367400
>return 0
>>
>>53367365
> B is objectively more readable than A
> objectively more readable
> objectively

This isn't someting that can be judged "objectively" by any known definition of objectivity.

That said, I genuinely find Allman style bracing slower to read than K&R, because every single opening brace in a line by itself gives my subjective brain a few miliseconds of a WTF moment as if I encountered a full stop in the middle of a sentence.
>>
File: Screenshot 2016-03-07 16.23.27.png (17 KB, 488x90) Image search: [Google]
Screenshot 2016-03-07 16.23.27.png
17 KB, 488x90
Thread replies: 79
Thread images: 4

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.