You use the patrician function formatting, right?

You use the patrician function formatting, right?

Other urls found in this thread:

gnu.org/prep/standards/html_node/Formatting.html
twitter.com/NSFWRedditVideo

yes but I’m probably going to just start using Allman because it’s the norm and I want to get a job

(defun main (argc argv)
...)

Use whatever the fuck you want.
If your workplace or your meaningful hobby project mandates style X, then use style X (obviously).
If you don't have a workplace or meaningful hobby project and are a fizbuzz-tier codelet, then is for you.

Noob

Actual programmer

int
main ( int argc, char** argv )
{
}

int main(int argc, char** argv) {
/* ... */
}

noob
int
main( int argc, char ** argv )
{ /* Begin main */
puts("Hello, world!");
} /* End main */

font?

#define begin {
#define end }

int main(int argc, char **argv)
begin
puts("Hello, world!");
end

Yes.
int main( int argc, char * argv [ ] ) {
{
// ...
}

This. Only this.

Consolas

int
main (argc, argv)
int argc;
char **argv;
{
/*
* Do something
*/
}

can you please fuckin stop

why cant everyone just use K&R

there is literally nothing wrong with it
also what is with the double spaces instead of indentation
what possible fucking advantage does that have over using tab

stop this autism right now. GNUfags please leave especially.

THE ONLY CORRECT WAY:
int main (int argc, char **argv)
{
// ...
return 0;
}

void main

>space between main and (

correct
everything else is dumb

ty

almost right user

int
main (int argc, char **argv)
{
return 0;
}

are you retarded?

int main(int argc, char **argv)
{
int *ptr;
if (condition) {
/* ... */
}
}

this

why even put a if then if you arent programming shit. is just junk code in middle.
just do the definition and leave it ALONe

why so inconsistent

It's not inconsistent.
For functions you put { on a new line, for conditionals you put it on the same line..

this one is correct

Opening braces go on the same line, retard.

The correct style.

It's inconsistent to have the brace on its own line only for one specific construct.

People who put spaces at the start and at the end of an expression inside of brackets should be gassed.

int main(int argc, const char * argv[])
{
// gay
return 0;
}

int
main(
int argc,
const char * argv[
]
)
{
return 0;
}

the only valid answer
rest are kode-tier

I agree

finally someone who is not a mental midget

Not him, but I do this for classes, structs and enums as well.
Only loops and conditionals have the { on the same line.

I'd like to point out that the reason behind this shit is both terrible tooling in C and a workaround to find function definitions using grep -Er '^foo' /path/to/src

>he uses puts and getc instead of printf and scanf

*inhale*
int main (
int argc,
char argv[][]
) {

/* ... */

}

Pajeet, C != java, go to your designated street please

You bloat up your document with extra newlines and less legible and searchable.

scrubs...
int main(argc, argv)
int argc;
char ** argv;
{
/* ...
*/
}

What the fuck OP? All programming should be done in binary or Qbinary. If you need all this bloated syntactical excrement you are not a programmer.

>declare things twice
Why would you do this?

int
main( int argc
char ** /* argv */ ) // does not use argv
{
/* ... */
}

Différent text editors have different interpretations and to how many spaces a tab is. It can cause issues in projects with multiple people, or languages that use white space (which I personally find fucking retarded)

0001 0101 0001 0111 0001 0010

>1 or 2 spaces: there's a place in hell for you
>4 spaces: master race
>8 spaces: borderline acceptable

>t. unemployed clueless code monkey desperate for attention on anime imageboards

name() {
}
name ()
{
}
Have always done the former but recently began switching all my shit over because it's GNU style standard.
It just looks so wrong ;_;

This. Everything else is stupid.

Why would you put the return type on another line thats retarded. Everything else is fine though

Yes.

C implicit-int, which is still valid in C11

I put the braces on their own lines for functions but use trailing braces on if/else/loops

this

int main(int argc, char **argv)
{
if(...) {
/* ... */
} else if(...) {
/* ... */
}

return 0;
}

"if" is not a function

Makes the function name stand out more, and easier to grep

int
main(int argc, char** argv) {
return 0;
}

def main(argc: int, argv: **char): int {
return 0;
}

Kek

this

int
main(
int
argc,
char
**argv) {};

Autism: the thread

Dubs confirm this is the only correct formatting.

int
main
( int argc
, char *argv[]
)
{ return 0
;}

I use the exact type in the OP's pic for everything else except for main, in which I place the return type on the same line with the rest of the function's header.

The microsoft style.

main(){return 0;}

On standalone functions
int foo()
{
}


on class member function and whatever comes inside it
class bar
{
int foo() {
if () {
// ...
}
}
};


This is the only acceptable way of formatting function, as stated by Linus himself

>2018
>classes

Also
>Linus
>using classes

the only correct style

Pretty formatting, user

fn main() {

}

It's the special brand of GNU autism that formats all C code as if it were Lisp.
gnu.org/prep/standards/html_node/Formatting.html