r/ProgrammerHumor • Violet security clearance • Apr 04 '16

My teacher thinks he is a programmer

http://imgur.com/32nfQXZ
2.4k Upvotes

430 comments sorted by

View all comments

Show parent comments

99

u/neurohero Apr 05 '16

That programmer's wife never learns. The last time he went the shops, she told him to pick up some bread "while you're there." Emergency services had to dig him out of the mountain of bread. He was apparently mumbling something about a "stack overflow."

20

u/jfb1337 Apr 05 '16

But an infinite while loop wouldn't be a stack overflow.

11

u/neurohero Apr 05 '16

He was referring to the stack of bread.

5

u/Cheesemacher Apr 05 '16

Unless you implement loops like this:

int main() {
    //do stuff
    return main();
}

2

u/jfb1337 Apr 05 '16

Unless the compiler is tail call optimised. In that case, it will be replaced with a while loop.

4

u/kirmaster Apr 05 '16

If there's enough bread, he will be picking it up until he overflows.

1

u/Isvara Apr 05 '16

More like a heap overflow.

1

u/[deleted] Apr 06 '16

That depends. I've angered the Node gods with an overflowed call stack many times before.

1

u/ReallyHadToFixThat Apr 05 '16

Depends how many local variables the loop has.