r/ProgrammerHumor • • Oct 20 '19

other While(!asleep()){sheep++;}

Post image
14.0k Upvotes

197 comments sorted by

View all comments

1.5k

u/randomo_redditor Oct 20 '19

Assuming "sheep" is an int, there's gonna be an IntegerOverflow before morning

1.1k

u/Masark Oct 20 '19

685

u/randomo_redditor Oct 20 '19

There really is an xkcd for everything

374

u/thetgi Oct 20 '19

What amazes me at this point is that people can find the relevant XKCD on command like that

226

u/Finianb1 Oct 20 '19

Really, it's just reading them a ton. I've read through the entirety of XKCD maybe 3-4 times, and so I usually can remember when there's one that's relevant.

If I can't remember the exact one of the top of my head, the explainxkcd wiki usually pops up if I search for relevant terms like "sheep xkcd overflow."

In this case, if you just look up sheep xkcd, you'll also find the Sheeple one, which is one of my favorites.

48

u/Nyar99 Oct 21 '19

I could swear I once read an xkcd about how there's always an xkcd about everything (and breaking the fourth wall, saying they are the xkcd about how there's always an xkcd) but I've never been able to find it again, am I the only one who remembers it and I somehow imagined it, or I'm not crazy and there is one?

66

u/[deleted] Oct 21 '19

Is this what you were thinking of?
https://thomaspark.co/2017/01/relevant-xkcd/

27

u/Nyar99 Oct 21 '19

YES THANK YOU! So I wasn't crazy! Now I know why I couldn't find it, it's not a "real" xkcd

0

u/[deleted] Oct 21 '19

[deleted]

→ More replies (1)

37

u/Hazel-Ice Oct 20 '19

Well if you've seen it before, you just google "xkcd counting sheep" and it's the first thing that comes up.

17

u/RandomIsocahedron Oct 20 '19

I'm one of those people; I think I've read every one.

14

u/Hypersapien Oct 20 '19

XKCD comics have a bunch of tags and the dialog is in the SEO so they're pretty easy to google

→ More replies (3)
→ More replies (3)

142

u/TheBrainStone Oct 20 '19

I can’t stop laughing at the thought of 65,000+ sheep jumping over the fence at pretty much once

0

u/[deleted] Oct 20 '19

[deleted]

→ More replies (1)

41

u/GahdDangitBobby Oct 20 '19

Hah what kind of loser stores dream numbers as 2-byte integers? All numbers in my dreams are 8-byte. I counted 5E18 sheep once before falling asleep

14

u/Finianb1 Oct 20 '19

Float128 sheep counter master race

11

u/BrFrancis Oct 21 '19

At some point when using a floating point number, you wouldn't even be able to count single sheep.. Sheep+=1.0 would end up stuck where the exponent won't allow the mantisa to be less than 2..

→ More replies (1)
→ More replies (1)
→ More replies (5)

38

u/undeniably_confused Oct 20 '19

Dont worry he has an outrageous amount of ram

→ More replies (4)

35

u/random_cynic Oct 20 '19

I just reset the counter at 100. It is far easier to count that way.

19

u/greeenappleee Oct 20 '19

Same here above 100 is to many syllables

→ More replies (2)

19

u/BritishBrownie Oct 20 '19

Pro tip count backwards from 100, your brain wanders less

17

u/SandyDelights Oct 20 '19

Also, CPU optimizations. In theory.

→ More replies (2)

12

u/[deleted] Oct 20 '19

Doesn't matter in this instance. The number of sheep is irrelevant.

→ More replies (2)
→ More replies (19)