this post was submitted on 15 Aug 2023
732 points (97.0% liked)
Programmer Humor
32464 readers
269 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This just prints:
Line 38 and 39 just check if a function that always returns false is false and if so, prints "๐ฉ\n". (C++ uses the bit shift operator for file IO for some reason)
Line 41 creates a vector of shared pointers to an abstract class, or in other words, an array of functions. Each function prints the emoji, mostly the same as the name, but not always. ( ๐ is the exception, it prints "๐\n")
43 and 44 just loop over the array and call every function inside, printing a bunch of emoji.
Line 46 returns the result of std::rand(), but because the programer forgot to call srand, the result is always the same (1804289383 for me).
(There are also a few missing includes, but I doubt this is intentional)