Using an IIFE, or an “Immediately invoked function expression”, lambda to initialize a global variable can have surprising side effects:
Because the global variables are initialized before the main is executed, the Hold my beer! and Hold my second beer! will be printed before the message from the main function is executed.
As a side note, on Windows, assuming that you have the MSVC compiler installed, you can build the above program with: