A C++ solution using macros.

Reviewed by @tolmasky.
C preprocessor almost solution.

Reviewed by @tolmasky.
Merge pull request #4 from tolmasky/master

A C++ solution using macros.