745
War Crimes (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] nothacking@discuss.tchncs.de 11 points 1 year ago* (last edited 1 year ago)

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)

this post was submitted on 15 Aug 2023
745 points (97.1% liked)

Programmer Humor

32069 readers
379 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS