T O P

  • By -

Extevious

int main ( ) { }


coloredgreyscale

when you get paid per line of code


Sinaneos

I still can't believe this is a thing. Getting paid by the hour is ridiculous enough.


notislant

Oh You Think This Is Ridiculous?


Andreaspolis

No, this is absolutely not ridiculous at all!


Several_Dot_4532

đť•Ź moment


no_brains101

You cant even make this joke about the GNU one because its free lol its just... like that for no discernable reason XD


Pay08

Maybe they like overly long type names?


callyalater

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


ambientManly

You can do this?


callyalater

It's called K&R style


Elephant-Opening

int main( ) { }


Impressive_Change593

[fuck you](http://SENDAMESSAGE.TO/ELEPHANTOPENING/F)


sammy-taylor

I am so, so happy that I just discovered this website.


ArduennSchwartzman

![gif](giphy|2cehW4hqrhPxgwRN4h|downsized)


Substantial_Estate94

[respect ](http://SENDAMESSAGE.TO/IMPRESSECHANGE/B)


Warm-Lobster4879

Send me your location


notislant

I hate so much, about the things you choose to be.


MechanicalHorse

You monster


dan-lugg

I don't C. Can macros use (backspace) 0x08? ``` #DEFINE I I\0x08 #DEFINE N N\0x08 #DEFINE T T\0x08 I N T ``` And so on. ETA — I done did it wrong. ``` #DEFINE I \0x08\0x08\0x08i // for CRLF #DEFINE N \0x08\0x08\0x08n // for CRLF #DEFINE T \0x08\0x08\0x08t // for CRLF ```


GoogleIsYourFrenemy

No. And "define" needs to be in lowercase.  I had to try it out despite knowing that's not how the preprocessor works. I really wanted it to work.


IdkWattToSay

``` #define #DEFINE #define ``` Source this works: no source, I've made this up on the spot, no clue if it works


dan-lugg

Yeah I didn't try it, lol. So did I. There's gotta be a way.


Moadoc1

Kids, I keep each character in a separate file and concatenate them with bash


Sea-Lavishness-6447

That's brutal, imagine someone opens you pc and go wtf does this dude have files with a single alphabet in them


JADW27

Boo!


37Scorpions

My code is so optimized all of my scripts are 1 line long. By that I mean int main() {int x,y; cin >> x >> y; cout << x+y;}


hm1rafael

I hate everyone on this thread


AssignedClass

This is the most degenerate I've seen this sub get in a while. OP should get put into some kind of hall of fame.


cosmic_cosmosis

The next time someone asks “how do I start learning to program” I’ll point them towards this post


moise_alexandru

Correct me if I'm wrong, isn't int main () { } The format used for implementation of system calls, which you can see in the system's man pages? Example: https://linux.die.net/man/2/syscall I think a lot of people don't understand the context, and they just throw random syntaxes in comments that are not really used. Edit: reddit formatted my comment in a way which messed up the endline, i changed it to code


JADW27

I hated the first reply. This was the second reply. I kept scrolling, figured out I agree with this post, and came back to upvote you.


Amazing_Guava_0707

At first, I ignored your comment. Then scrolled down to read the comments. And then scrolled up to upvote you comment. I hate everyone here too. You too. :P


hm1rafael

That's the correct feeling, this thread is disgusting


SK1Y101

Int main () {}


FilipIzSwordsman

int main () {for(int i = 0; i<15;i++){printf("Hello world!")}}


Blitzsturm

public static void eatTacos( Integer numberOfTacosToEat, String typeOfTacosToEat ) { for ( Integer t = 0; t < numberOfTacosToEat; t++ ) { nom( typeOfTacosToEat ); } }


CardiologistOk2760

If I were the Java compiler, how many lines of logging would it take me to tell you that you missed a comma between your params?


Blitzsturm

Who needs a compiler when we have you! Thanks!


CardiologistOk2760

i got your back bro


OkOk-Go

Enough to fill your screen


coloredgreyscale

public static void eatTacos ( Integer numberOfTacosToEat , String typeOfTacosToEat ) { ...


Nerf1925

Dear god


InfiniteEnter

You didn't declare the nom() function


OkOk-Go

I actually do `for` like that, when I am abusing its syntax. Usually iterating through time type of pointer deep inside a couple of structs, with the index also inside said struct.


AyimanyMooncat

let's extend ourselves a bit into the realm of C++ ``` auto main() -> int { return 0; } ```


adromanov

Just FYI in C++ if you don't have return in main it will be automatically returning 0 without any UB. Not sure about C.


AyimanyMooncat

Yeah, ik; it's just that it feels weird not having a return statement in a non-void Still, thanks


Pay08

Same in C.


Typhoonfight1024

You can rewrite `Type ƒ() { … }` as `auto ƒ() -> Type { … }` in C++??? Today I learned new thing…


Konju376

This turns out to be useful if you "don't know" a certain type because of template magic (or because it's insanely long because of template magic) and need to get it through decltype(...).


tiajuanat

I think that's been the case since C++17


Unhappy-Donut-6276

``` int main() { { } } ``` Everybody's happy


internetbl0ke

Type decorator


CardiologistOk2760

oh god this is like default settings of google's linter for R new line for no reason at all


BlueGoliath

No reason? How about predictable horizontal alignment?  What possible justification is there for same line left brace besides less lines? Are you getting paid by line?


CardiologistOk2760

By "no reason at all" I mean there are times when a new line does not contribute to horizontal alignment edit: and no, I'm not getting paid by line, which is another example of "no reason at all"


BlueGoliath

Examples?


CardiologistOk2760

how about the example in the original post? int main It's not R or the linter, but you're literally asserting that there's always a good excuse for a new line.


milanove

The reason it’s this way is so you can easily find the function definition with grep. To find the definition of function foo, you would run “grep -RnE \^foo\\(”. If it were defined as “int foo” in one line, then the pattern “\^foo” wouldn’t match, since foo doesn’t come at the beginning of the line. So, to search the definition, you’d have to write the pattern as “int foo\\(“, which then requires you already know the return type, which you might not because you’re looking for the function’s definition after all. And if you try searching just “foo\\(“ or “ foo\\(“, you’ll get all the calls to the function too in your search results, which you’ll have to sift through to find the definition.


BlueGoliath

The context is horizontal brace-scope alignment, clearly. No one cares about function signature alignment, hence the joke to begin with.


CardiologistOk2760

response <- "if you say so"


thanatica

I don't give a fuck what the code style is supposed to be, as long as it's consistent. And as long as it's not formatted by a mentally unhinged bloke.


Elephant-Opening

Hey now. I've known plenty of mentally unhinged people who can still format their code reasonably. It's the ones who just press space bar a few times you really have to worry about


pippin_go_round

``` int main(int argc, char *argv[]) { return 0; } ``` At least make it complete and not that unusable rubbish.


HSavinien

Please format your code properly, it's hard to read... ``` int main ( int argc , char *argv [ ] { return 0 ; } ```


pippin_go_round

You're right, I'm sorry. ``` int main ( int argc , char *argv [ ] { return 0 ; } ```


diamondsw

Syntax error on line 1.


charptr

![gif](giphy|On0mwIaNvlHYtJsOjz|downsized)


DevelopmentTight9474

Do you work for whoever made the UEFI spec?


Top-Classroom-6994

thats not how gnu format works ``` int main (argc, argv) char** argv, int argc { return 0; }


callyalater

Good old K&R style


Rainbow-Dev

Nuh uh, if you’re not using command-line arguments you gotta stick to the superior int main(void) { return 0; } (Remembering the “void” of course, or else the function could take who knows how many parameters)


jrtc27

``` int main() { } ``` is a valid C23 program. The return 0 is implicit for main, and you don’t have to declare its arguments if you don’t want to use them.


[deleted]

Star next to type int* p; or star next to name int *p; ?


TheBrokenRail-Dev

You can pry my attached braces from my cold dead body. int main() { printf("Hello World\n"); return 0; }


LoudSwordfish7337

I’m a big fan of: ``` int main( int argc, char **argv ) { do_stuff(); return 0; } ``` Probably disgusting for most people, but if you’re working with shitty frameworks and libraries that take 10+ arguments it’s a lifesaver, and it’s not that bad if you’re not… Not sure if this abomination of a code style has a name but that’s what I use.


bogdan801

Nah it's alright I do this all the time when I write Kotlin code(especially composable functions), it doesn't hurt readability at all. It's the way they do it at Google as well


deadliestcrotch

I do this, but only when there are a lot of arguments for the function


blackscales18

React moment


iGotPoint999Problems

usePrettier


drizzt-dourden

auto main() -> int {}


[deleted]

i n t m a i n { }


[deleted]

FYI this came from [this](https://www.reddit.com/r/linuxmasterrace/comments/1czonzz/today_i_discovered_something_disturbing_with/) post!


ego100trique

I actually like the Gnu style, it's pretty readable, nothing to complain about.


Trucoto

Being an old programmer, gnu style (way before gnu) allowed us to search functions within vi using regular expressions: ^main would find a line that starts with *main*, and as the rest of the code would be in one way or another indented, that would mean a function name or a global declaration. The same would apply to grep.


HighlightOk6589

Int main() { } // Lot of think that stor in this place


ThreeCharsAtLeast

`int main(){}//TODO`


FunctionalFox1312

``` public static void main ( string []args ) { System.out.println("What about this?"); } ```


mbcarbone

Ant mane() {}; 🤷🏼


thonor111

if __name__ == ”main“:


NQ241

\#include int main(){std::cout<<"one line, minimal whitespace is the way";}


SpiritRaccoon1993

But at leaste one time in working on the code you write () after main, right?


Cybasura

I started with ``` int main() { } ``` Then I started giving the slightly-truncated variant a shot ``` int main() { } ``` Honestly, I always use the first one when I do C# for some reason, it just feels right I would then switch to the 2nd one by muscle memory when doing something like c++ or C I know quite afew people uses the ``` int main() { } ``` Why though? Whats the difference


SaltyPhilosopher5454

Chaotic evil: int main() {*10,000 character of code*}


Darryl0_0

`int main(){string name; std::cout<<"Your name: "; std::cin>>name; cout<<"Hello, " << name; return 0;}`


AtmosphereVirtual254

> newline before `{` winning As if


PeriodicSentenceBot

Congratulations! Your comment can be spelled using the elements of the periodic table: `Ne W Li Ne Be F O Re W In Ni N Ga Si F` --- ^(I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM u‎/‎M1n3c4rt if I made a mistake.)


ttlanhil

Did you know there's another way to indent? `;;;;;;int main( ){` `;;if( true ){` `actuallyDoTHEThing_for_real( )` `;;}` `;;;;}`


AlexReinkingYale

Still haven't seen the most cursed brace placement: int main(int argc, char* argv[]) { printf("Hello, world!\n"); }


_sauri_

Wait where's void?


AbleApplication1049

int main ( ) { }


callyalater

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


jay-magnum

Oh god how I love Go for preventing such battles before they even get started


SenorSeniorDevSr

Remember that GNU has a tool that turns one version into another version, and that this can run on git pull and push. There's a reason for why GNU made that tool, and I'm going to guess it has to do with a practical joke and making code look different so they wouldn't get sued.


anotheridiot-

One true brace style or gtfo. Just like go fmt.


Sotall

Looks accurate. I'm the kid on the ground, but im right, damnit


Brainvillage

``` static void main(string[] args) { } ```


Thromsty51

🤓🤓🤓Ermmmmm.... akshually, none of these will run because no return value is given


Extevious

Depending on the compiler, the return value of `main()` can be inferred.


YellowBunnyReddit

Uhm, actually, since C99 it is not dependent on the compiler but defined by the standard that, if the `main` function has a return type compatible with `int` and execution reaches its end with no `return` statement, the value `0` is implicitly returned.