By bloid
via adampetersen.se
Published: Apr 04 2007 / 09:27
Using C++ template metaprogramming, I'll try to solve FizzBuzz by having the compiler output the solution as error messages. This program is impossible to outperform with respect to run-time performance; it will actually never run! And hereâs the nice touch: the program will deliberately not even compile! The interesting part is that as error message, the compiler outputs the FizzBuzz solution.



Comments
bloid replied ago:
I love stuff like this :-D
pcx99 replied ago:
"Now, the only question that remains is: would I pass the interview?"
\Main.cpp(36) : error C2039: 'compilation_error_here' : is not a member of
'boost::mpl::vector101
With buggy code like that? Geez.
Great link Bloid, I got a real kick out of it!
Voters For This Link (8)
Voters Against This Link (1)