So is proper bracketing technique:

So is proper bracketing technique:
//code
{
//code
}

Or


//code{
//code
}

Other urls found in this thread:

en.wikipedia.org/wiki/Indent_style
youtu.be/_peUxE_BKcU
twitter.com/NSFWRedditVideo

Both.

Bottom is for poo in loos top is for real devs

Which one are you?

//code
{
//code}

I personally prefer the former because it's a lot easier to read and debug, esp. if I want to commit the shit to my repo for other people to see and use

int
foo (int, int)
(arg1, arg2)
{
printf ("hello world!\n");
return 1;
}

top for compiled languages and bottom for interpreted languages

code() { return "code " }
Everything else is wrong

//code(){//code;}//code;

#2, but I don't give a shit what you do on your own projects as long as you don't do:

if (foo)
bar;

If you do this and you're not a Python programmer, die in a fire.

Did a python programmer fuck your mom or something?

>reading comprehension

(code
code
...)

if (!cond)
for (i = 0; src[i]; i++)
for (j = 0; src[j]; j++)
dest[i][j] = src[i][j];

Personally, I prefer 1 for functions, 2 for function content.

code{

}edoc

whatever everyone on the project does

I have my preferences but I'm not militant about it

That being said if you put parens around things where they aren't needed you are a big fucking retard.

>not militant
>you are a big fucking retard.

Sounds like YOU are a big fucking retard.

Parens aren't brackets fuckface.

If I had a nickel for every time this sort of cuteness introduced a bug when suddenly one line had to become two.

Stop being cute. You're not K or R.

bottom one is way cleaner imo, but I use both depending on the language

No shit, you big fucking retard.

The GNU coding standard is fucking stupid. Absolutely haram.

en.wikipedia.org/wiki/Indent_style

K&R is best

for( i = 0; i < 10; ++i ) {
printf( "OP is a faggot\n" );
}

youtu.be/_peUxE_BKcU

(you)

Rajesh please we all know that the gnu coding standard is the cleanest and easiest to visually interpret

Whatever the rest of the team agrees with.

But brackets are absolutely required for all applicable statements where the language treats them as optional.

That's an important surface area to guard against sloppy, new or inexperienced teammates.

>not Pico style
Yall niggas need Jesus
while (x == y)
{ something();
somethingelse(); }

This unironically bothers me.

> GNU style
> clean and readable

The Allman coding style is the only coding style that all programmers should follow. Other coding styles are haram and unreadable.

top is for hobbyists that have never worked in the industry.

>nonfree bracket placement

code
singlelinemethod

And

code {
code
code
}

I went to a major engineering uni and work for one of the big defense contractors. Everyone at both does #2, and so do I.

code()
{
// moar
}

- Brackets line up with each other
- Blank line + indent produces nice spacing

code()
{
//moar
}

I jumpered an 8086 mobo on breadboard at age 9 and burned the bios with a battery by 10. I do #1

You monster

This is worse:

if( iLikeBrackets ) { put themIn }

Whatever the coding style standards are for that language

No such thing. There are parser rules, but after that readability is king.

Different in different situations.

Former for classes and namespaces
Latter for loops, data entry and maybe functions

Generally I use them interchangeably because I do think the former looks nicer.

Best me to it.

Literally what?

You mean compile time?

Readability and efficiency always wrestle for king, moderation and minimalist code balances them so you get as much done as possible in the most concise manner.

Write code to be read, but be mindful of what's going to kill your efficiency.

I mean with regards to spacing.

Readability /of the algorithm in question./

That is, I use whatever spacing best makes the algorithm comprehensible, but default to brackets on their own line (so paired brackets line up.) This is an objective default which directly improves comprehension -- as opposed to the subjective one which apparently most shops adopt (opening brace on same line as statement.)

Funnily, someone when seeing code with the dropped open brackets, exclaimed "i can't read this! all this.. this.. blank space.." -- and our team lead looked at him surprised, blinking .. blankly...

I was surprised to hear it too, but to each their own. I find all-on-first line virtually unreadable and cluttered, and personally think our tools should simply transparently convert for us for version control.

...

OUT.

Just followed it back. Bro, have you ever done VHDL or Verilog? You should check it out, if you like electronics you can make a low power bitcoin miner.

>"i can't read this"
Histrionics aside, endless blocks of code like endless walls of text will drive people mad.

Basically unless you hate your coworkers or github subscribers, you will conform to a very readable style. That's just it. If you write like a stereotypical PHP dev or like you're frustratingly trying to get Basic to work, there are objectively better ways that encourage readability.

BTW, real tabs encouraged movement by keyboard rather than mouse ; )

Neat.

...

>Needing a fucking class for that
kys

It's probably a homework assignment.

int CheckNewCellHead(int left_cell)
{
if (left_cell