Link Details

Link 17588 thumbnail
User 111696 avatar

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.
  • 8
  • 1
  • 1658
  • 177

Comments

Add your comment
User 111696 avatar

bloid replied ago:

0 votes Vote down Vote up Reply

I love stuff like this :-D

User 209881 avatar

pcx99 replied ago:

0 votes Vote down Vote up Reply

"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!

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (8)



Voters Against This Link (1)