What indent style do you prefer?

What indent style do you prefer?

Right.
Both are ugly as fuck tough.

Right but I use left for functions.

right for fewer keystrokes

left for aesthetics

t. non-programmer

Second way for life

>not using python

Enjoy your unstandardized style faggots

What ever the company code style dictates.
I have my vim setup to auto-format and it can enforce one bracket style or the other. I just type normally and regardless if I put them in the "wrong" place it will move them to meet the given style.

Since both are ugly, how do you do it?

GNU style is the only right way.

Left for adults, right for newfags who think less lines and more information density is better.

Literally why

To be edgy and different and unique and Lisp-like and completely incomprehensible and useless. Basically everything GNU stands for.

Left for functions and higher level, right for everything else.

>not indenting the curly brackets to be in line with the block
Left would be my choice if the brackets weren't a tab behind.

I use both.

Right. Always right. Left is the fedora tier "classy" way.

Always left. Then again I like to use a lot of whitespace, not just vertically, but also horizontally.

Left for c and c++, right for java and perl.

>right for fewer keystrokes
you could have your ide arrange them and fix the stiles on save, so key stroke argument doesnt really matter

also, fucking JS looks like shit whichever style you use

right

Maybe if you didn't use such a shitty font

You could literally have your IDE do all the heavy lifting and generate most code for you, but apparently the Luddites at Sup Forums get enraged at that idea.

if (
condition
)
{Statements
;}

:^)

I reserve left exclusively for main()

oh god no

>pragmata
>shitty font

Left for insufferable men with unshaved necks who use debian and claim to be more mature and sophisticated than you because all their shit is retro, right for normal people.

Left for old farts with vision problems, right for people under 50.

Left for baby ducks, right for people with vision unclouded by nostalgia and dogma.

What's the point of that? Is inconsistent style what all the cool kids are doing?

Left....but then I minify everything later to fuck with any parjeet that needs to maintain my code.

He's the first in , but he might use BSD instead

>pongjeet knows how to use GNU format

Chapter 3: Placing Braces and Spaces

The other issue that always comes up in C styling is the placement of
braces. Unlike the indent size, there are few technical reasons to
choose one placement strategy over the other, but the preferred way, as
shown to us by the prophets Kernighan and Ritchie, is to put the opening
brace last on the line, and put the closing brace first, thusly:

if (x is true) {
we do y
}

This applies to all non-function statement blocks (if, switch, for,
while, do). E.g.:

switch (action) {
case KOBJ_ADD:
return "add";
case KOBJ_REMOVE:
return "remove";
case KOBJ_CHANGE:
return "change";
default:
return NULL;
}

However, there is one special case, namely functions: they have the
opening brace at the beginning of the next line, thus:

int function(int x)
{
body of function
}

Heretic people all over the world have claimed that this inconsistency
is ... well ... inconsistent, but all right-thinking people know that
(a) K&R are _right_ and (b) K&R are right. Besides, functions are
special anyway (you can't nest them in C).

kek

Note that the closing brace is empty on a line of its own, _except_ in
the cases where it is followed by a continuation of the same statement,
ie a "while" in a do-statement or an "else" in an if-statement, like
this:

do {
body of do-loop
} while (condition);

and

if (x == y) {
..
} else if (x > y) {
...
} else {
....
}

Rationale: K&R.

Also, note that this brace-placement also minimizes the number of empty
(or almost empty) lines, without any loss of readability. Thus, as the
supply of new-lines on your screen is not a renewable resource (think
25-line terminal screens here), you have more empty lines to put
comments on.

Do not unnecessarily use braces where a single statement will do.

if (condition)
action();

and

if (condition)
do_this();
else
do_that();

This does not apply if only one branch of a conditional statement is a single
statement; in the latter case use braces in both branches:

if (condition) {
do_this();
do_that();
} else {
otherwise();
}

I use both. right in Java and JavaScript. left in C and C#

Agreed, left is what the geezer who wrote my computer science course writes in, as well the teacher, right is how I write code, and now all the little code cadets are gonna be writing like a polish woman attempting to copy an old man. Except they all have inconsistent indents and use fucking spaces instead tabbing because that's what the teacher did. TEACHIN THEM RIGHT

Sue me
#include

int is_odd ( int n ) {
return n % 2 ;}

int main () {
const int N = 100 ;
for ( int i = 0; i < N; ++i ) {
if ( is_odd ( i ) ) {
printf ( "Odd\n" ) ;}
else {
printf ( "Even\n") ;}}}

Yes, you're correct.

I'm fine with both. It just depends on what the existing code already uses. Consistency trumps all.

If I'm starting from scratch, I think I would probably do the left, though.

>space between function name and parameters

>use fucking spaces instead tabbing
That's actually proper practice. Different editors render tabs differently, so for best portability you should be sure to use spaces (and change settings in your editor to use spaces instead of the indent character)

:^(

>Do not unnecessarily use braces where a single statement will do.

Until someone rewrites

if (condition)
do_this();


into

if (condition)
do_this()
and_that()

I do the one on the right because my first language was [spoiler]action script[/spoiler]

which is a good font, what about this??

>tehnical reasons for indentation

oh man this is old

>muh character cell terminal only has 80 columns and indentation aware line wrapping doesn't exist, stop making me scroll horizontally

See above

Spaces for alignment, tabs for levels of indentation

This will align everywhere with a monospaced font
T->T->int a
T->T->____ b

This does not apply if only one branch of a conditional statement is a single
statement; in the latter case use braces in both branches:

if (condition) {
do_this();
do_that();
} else {
otherwise();
}

Liking it, what is it?

ew.

I always make sure my editor uses spaces instead of tabs characters I just like the consistency of tabbed indents. Also, many editors allow you to highlight several lines and indent them all at once with tab, but if you do the same with spaces, you just erase all of your code

its called monoid, found it the other day

Thanks man. Take a look at inputfont

Efficient code design says you are a fucking idiot. Lining up code block brackets is a good, beautiful, and efficient code practice that allows for better maintenance, debugging, and editing.

Stop being a fucking contrarian "old people code like this hurhur" moron, child. Let me know when you've written thousands upon thousands of lines of mission-critical goddamn code and fucking rely on the formatting of your code to make the most sense possible.

Oh wait, that will never happen. Because people will take one look at your ugly code and never even consider hiring you.

...acceptable. Carry on.

Yeah show him how real apps are made.

...

You sound like you wear a classy hat and cultivate hair on your neck

>brackets
>2016

left

making working pages longer is something I don't mind considering it also increases clarity of visualized code.

why not inline it?

Beautiful.
Teach me your ways, master.

Most unreadable shit ever. Sure it looks nice in the example, but a soon as you a have a file with a few thousand lines of code, it just turns into a mess.

don't you own a 16:9 monitor?

>Don't ask me for evidence, I have none. Only autistic conjecture i thought of in the shower.
>Now, if you'll excuse me, I have an irresistible urge to suck a dick
>Hey, is that dog not neutered? Score!

Right, because I prefer the opening of the conditional and the closing of the conditional to each occur on exactly one line.

Left. My vision's kinda shit and the left is easier for me to read.

...

Too bad for you, I'm the type of architect that only designs buildings with stairs because ramps are an ugly waste of space and elevators are bloat

Fine, I'll just use a different building.

#include

int is_odd ( int n )
{ return n % 2
;}

int main ()
{ const int N = 100
; for ( int i = 0; i < N; ++i )
{ if ( is_odd ( i ) )
{ printf ( "Odd\n" )
;} else
{ printf ( "Even\n" )
;}}}

Your style is autistic and you don't even know to write a simple odd number checking function. I can feel the tumors growing

why do people not put brackets on their own lines

it's so easy to identify code blocks with it, you just look up and down and you instantly know what is what

Do you really think I write code like that?

Also, the function works, so who gives a shit.

I use both.

You are a fucking idiot.

Good, I don't want any crippled members of the untermensch in my non harmful UNIX way building.

Right.

Left is objectively shit.

>indent style

I use python

None. It was hard to write, it should be hard to read.

Left if I'm writting C#, right if I'm writing Javascript.

Both are fine.
But I use right.

Left for functions.
Right for initializer lists, structs, unions, and enums.

if
(
condition
){
Statements
;}

Mothers and current crushes

good job not answering my question

Why not just go all the way?

This thread has gone too far.

if(something)
goto fail;
goto fail;

Left always. Right is useless.

fewer keystroke* if you are using a good editor.

Python is not a real programming language, it is a scripting language.

No.

#include
int is_odd(int n){return n%2;}int main(){const int N = 100;for(int i=0;i

I often use
if() myfunction() else myotherfunction()
this looks great

Left, but I was always taught to add a space between alphanumerics and symbols. Is that bad?

#include

int is_odd( int n ) {
return n % 2;
}

int main ( ) {
const int n = 100;
for( int i = 0; i < n; ++i ) {
if( is_odd i ) ) {
printf( "Odd\n" );
}
else {
printf( "Even\n" );
}
}
return 0;
}

Left. For some reason it's much easier to read.

Right is an artifact of the old times when screens were only 25 lines tall.

Now that we live in the era of 1200+ pixels of vertical space, left is the clear aesthetically sound choice.

Left.

Right. For some reason it's much easier to read.

Left is like. putting a period in the middle of a sentence.

does it matter? every company needs a benevolent dictator to just decide stupid shit like this.

Sasuga Windows Phone poster