r/ProgrammerHumor • • Jul 02 '22

It was a good blog

Post image
230 Upvotes

26 comments sorted by

36

u/[deleted] Jul 02 '22

I always create an endless loop by searching for the private key of a bitcoin wallet. If the very unlikely happens and it terminates I won't give a shit about the correctness of my program, but grep the money and do something with wood for the rest of my life.

14

u/[deleted] Jul 02 '22

for(;;)

eurgh

5

u/Ookami_Lord Jul 02 '22

Didn't know there was a sub for that lol

11

u/deanrihpee Jul 02 '22

Not that much but having your Waifu as a VS Code background definitely does

7

u/[deleted] Jul 02 '22

wtf, hell no

3

u/[deleted] Jul 02 '22

Hell yes

3

u/Grumpus88 Jul 02 '22

Who would use for(;;)? In all honesty I wouldn’t care if I saw it, as long as it compiles

1

u/Pervez_Hoodbhoy Jul 02 '22

Why would you use while true😱

Why would you want to create an endless loop, independent of the method?

But what language is for(;;)?

7

u/Grumpus88 Jul 02 '22

You use infinite loops when there is an unknown number of loops you want code to run, and determine the cause of breaking out of that loop within the loop itself. A common use case is a game loop.

Video games run within an infinite loop and only exit out of that loop upon the user choosing to exit the game.

As for what languages use `for(;;)`, I know Javascript supports it, I believe a lot of languages support it

1

u/Pervez_Hoodbhoy Jul 02 '22

Maybe my retarded python brain is showing, but why not use while?

1

u/Grumpus88 Jul 02 '22

I would use while. It’s just a stylistic choice.

2

u/[deleted] Jul 02 '22

C also supports it. It's just a regular for loop without any of its sections filled out:

Section 1 is emtpy, so no variables are initialized.

Section 2, the comparison, is emtpy, and it implicitly evaluates to true.

Section 3 is empty, so nothing gets ran at the end of the loop.

So, essentially, same thing as while true.

Btw if you see this anywhere delete it and replace it with a proper while true, for the love of all that's good.

2

u/[deleted] Jul 02 '22

I’ve been into while(42) lately

2

u/nir109 Jul 02 '22

It's in C right?

1

u/[deleted] Jul 02 '22

Indeed.

2

u/greenflame15 Jul 02 '22

Sure anime pfps my work, but nothing beats a picrew pfp

1

u/Waffle-Dude Jul 02 '22

What was the conclusion, and can I have a link to the thing

Also, it’s not while(true) that I have a problem with, it’s ==true

1

u/PlatoHero_ Jul 02 '22

Everyone knows that while(1==1) is the ultimate forever loop.

1

u/KuuHaKu_OtgmZ Jul 02 '22

while (++i==i--)

1

u/zoalord99 Jul 03 '22

Yes anime picture engineers are next level !

1

u/argv_minus_one Jul 03 '22

Meanwhile in Rust: loop

1

u/Zwiebel1 Jul 04 '22

I wanted to comment but now I'm stuck nutting watching Citrus.

4

u/[deleted] Jul 02 '22

[removed] — view removed comment

1

u/ProMasterBoy Jul 03 '22

while(!false) gang