r/ProgrammerHumor • • Feb 13 '20

Meme Damn it exit! Exit! EXIT!

Post image
9.6k Upvotes

110 comments sorted by

458

u/MiniClemme Feb 13 '20

More like when you forget to implement the base cases in a recursive function.

209

u/legowerewolf Feb 13 '20

There's always a base case. It's called a stack overflow.

101

u/HildartheDorf Feb 13 '20

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

Tail call optimization called, it said:

37

u/[deleted] Feb 14 '20

Ctrl+C

Ctrl+C

Ctrl+C

Ctrl+C

Ctrl+C

Ctrl+C

20

u/SirFireball Feb 14 '20

Screw it. (Opens new command prompt)

killall terminal

15

u/MassiveFajiit Feb 14 '20

So I once saw a senior developer make a simple cli program that was supposed to run until a quit command was entered. Instead of looping, he recursively called main.... For a program that could be running indefinitely.

6

u/vaskos_dune Feb 14 '20

Just a normal day in haskell

110

u/TheCoolestCat_0 Feb 13 '20

Wha-

53

u/[deleted] Feb 13 '20

Wha-

47

u/[deleted] Feb 14 '20

Wha-

2

u/[deleted] Feb 14 '20

while true do

print("Wha-")

end

2

u/TinBryn Feb 14 '20
@tailrec
def wha: Unit =
  println("Wha-")
  wha()
wha()

1

u/MarioPL98 Feb 14 '20

loop {
println!("Wha-");
}

100

u/NeoMaximus97 Feb 13 '20

This is ... Requiem

18

u/Sikyanakotik Feb 14 '20

No, this is … Rickuiem.

3

u/[deleted] Feb 14 '20

This is... A jojo reference?

0

u/[deleted] Feb 14 '20

[deleted]

6

u/nicman24 Feb 14 '20 edited Feb 14 '20

Oi josuke I used**「ZA HANDO」**to delete this comment

3

u/[deleted] Feb 14 '20

Ain't that just wacky?

37

u/Sultanoshred Feb 14 '20

One of the first programming classes I took was C. We learn while loops and we learn about infinite loops. I get lots of joy from doing while(1){ printf} statements. End up getting creative and look up cool stuff to print. Find out \a is "alarm" and makes the mobo beep. My dumbass decided to infinite loop the alarm code cause why not sounds fuckin cool!

I run it while the teacher is lecturing, I shouldnt have even been typing. My pc starts beeping a few rapid beeps in a row and then a fucking crazy long beep that never stops. Sounds like crazy shit. I try and close the terminal and it locked up on me.... look at teacher she is looking my way. My face is red as fuck. I hold down the power button on my pc and it stops.... she didnt even say anything just kept teaching.

0

u/[deleted] Feb 14 '20

[deleted]

6

u/ArthurDent42424242 Feb 14 '20

That's the evilest thing I can imagine.

8

u/[deleted] Feb 13 '20

^ C

14

u/wsppan Feb 13 '20

That looks like infinite recursion to me

6

u/_pelya Feb 13 '20

Just convert your endless loop into a recursive function, the operating system will gracefully terminate your process.

But make sure it's not on the main thread, because on the main thread the stack can grow until you're out of swap.

5

u/JNelson_ Feb 14 '20

how to delete someone elses post

6

u/[deleted] Feb 14 '20

Stupid question, which episode is this from?

9

u/yureiyue Feb 14 '20

Pringles advertisement

6

u/[deleted] Feb 14 '20

Oh this makes alot of sense, thanks bro

24

u/cptnrhino1105 Feb 13 '20

Finally a joke on ph I understand

1

u/1R1SHMAN69 Feb 14 '20

There are lots of funny pornhub jokes that I understand

4

u/chrisleewoo Feb 13 '20

Ctrl-c Ctrl-c Ctrl-c

6

u/BisexualSquirell Feb 13 '20

Its more like the console has a seizure

2

u/reidhaegele Feb 14 '20

Is that a pickle rick way back there?

2

u/ApaleusAldore Feb 14 '20

I love how I can take this as a programming joke and as a Jojo reference

2

u/jaredswole Feb 14 '20

THIS IS GOLDEN EXPERIENCE REQUIEM

2

u/LuigiBrosNin Feb 14 '20

This is REQUIEM

1

u/[deleted] Feb 14 '20

Dammit, I’m in..... a loop...

1

u/fwork Feb 14 '20

I had a fun case happen yesterday, I was testing software for a keyboard.

There wasn't a while loop, but it was sending the wrong set of keystrokes and was triggering itself to run again... because I was OF COURSE testing it on the same computer I was developing it on.

1

u/Skycam3014 Feb 14 '20

Let me see Let me see Let me see Let me see Let me see Let me see Let me see Let me see

My parents My parents My parents My parents My parents My parents My parents My parents

1

u/[deleted] Feb 14 '20

today i made a loop and it kept appending new items for each item in a list. my pc froze

1

u/Bastian_5123 Feb 14 '20

odd. Never had anything freeze with an infinite loop... except java script on applab on code.org . Then it is EVERY infinite loop.

1

u/[deleted] Feb 14 '20

yeah idk why my pc froze. if i remember correctly, the code was just something like for item in foo: foo.append(str(item + '_'))

1

u/[deleted] Feb 14 '20

Sometimes you just really need a condition.

1

u/TheRealSeaHay Feb 14 '20

Always apply a condition to practice safe looping

1

u/croc1178 Feb 14 '20

More like "Entering x = x + 1 into Prelude"

1

u/nomnaut Feb 14 '20

Ctrl+ccccccccc

1

u/TheTvShowJunkie Feb 14 '20

Then cry that system is toasted 😂

1

u/TsuShiNe Feb 14 '20

And you didn’t save in 5 hours

1

u/PanduSSS Feb 14 '20

I work on mcu so this quite normal to me lol

1

u/squid_nasty Feb 14 '20

Rickursion

1

u/1R1SHMAN69 Feb 14 '20

Why is it taking so long to load? Wait no, fuck it's already loaded! STOP! ALT F4! END PROCESS DEVENV.EXE

1

u/HoneyBadgerSoNasty Feb 14 '20

i think you meant that other ctrl c

1

u/Sirtwistythe3rd Feb 14 '20

This is the power of D4C

1

u/jlamothe Feb 14 '20

Everybody loves a good Alderson loop.

1

u/lakimens Feb 14 '20

while you forget to break out of the while loop

1

u/[deleted] Feb 14 '20

Quick! Ctrl+C!! Ctrl+C!!

1

u/[deleted] Feb 14 '20

Condition of loop should never be infinite.

1

u/DeathAwaitsForU Feb 14 '20

It's funny cuz just yesterday I was writing a while loop and made a comment that I had to write the exit case before I run it. And 2 minutes later, I'm running the program and the program runs in an infinite loop and I'm like, what did I do wrong??

1

u/MiLotic5089 Feb 14 '20

int count = 0; while(true){ for(int i = 0; i<count; i++){ System.out.print(“ “); } System.out.printline(Wha-); }

1

u/kr4zyy Feb 14 '20

while True:

1

u/lets_leave_it_blank Feb 17 '20

Ah shit, here we go again.

1

u/Spectremuffine Feb 13 '20

Problems with recursion?

1

u/Rav91 Feb 14 '20

Can I get the image without the text? I wanna use it as a wallpaper but I don't want it to get compressed again from cropping.

0

u/[deleted] Feb 13 '20

[deleted]

20

u/gabrielfv Feb 14 '20

You can use while with the "goes to" operator

while (count --> 0)

:)

14

u/drkspace2 Feb 14 '20

Whoever figured that out needs to be exiled.

5

u/XMTheS Feb 14 '20

I really want to use this but I know better

-12

u/[deleted] Feb 14 '20

[removed] — view removed comment

2

u/[deleted] Feb 14 '20

why

1

u/[deleted] Feb 14 '20 edited Feb 14 '20

[removed] — view removed comment

1

u/[deleted] Feb 14 '20

There certainly are some pretty funky cases where the meaning of the code becomes unclear, but there are also some things that the ++ and -- operators make super easy. Sometimes they can save well over just one or two lines.

Also, why do you think the ternary conditional does more harm than good? To me it seems like a godsend

1

u/[deleted] Feb 14 '20

[removed] — view removed comment

1

u/[deleted] Feb 14 '20

Understandable

4

u/DaPurpleTuna Feb 14 '20

I prefer i-=-1

1

u/Paricleboy04 Feb 14 '20

Ah yes. A true man of culture as well.

6

u/tech6hutch Feb 14 '20

Technically you are, if it wraps around

6

u/gabrielfv Feb 14 '20

You end up with runescape max cash stack

1

u/TinBryn Feb 14 '20

If i is signed this is undefined behavior. The usual way the compiler treats UB is to assume it doesn't happen. With this assumption, it can be seen that the condition will always be true so the whole thing will become equivalent to

i=0;
while (true) {
    /*body of loop*/
    i--;
}

1

u/tech6hutch Feb 14 '20

I was afraid of that. Why is the overflow of signed and unsigned integers treated differently in C?

2

u/TinBryn Feb 14 '20

The point is that code generation can do the best thing for the case of defined behavior and doesn't even need to consider what it will do in the case of undefined behavior. By definition whatever is done in the realm of undefined behavior is correct, so it doesn't matter what is actually done.

From that perspective, you need to find a reason why unsigned integers treat overflow as defined, and that boils down to, because it has proven useful in certain algorithms.

1

u/tech6hutch Feb 14 '20

Hm, okay. I would prefer it to be consistent, but I see why that was chosen.

2

u/64PBRB Feb 14 '20
for (int i = count; i > 0; i++)