I compile one of my C codes with a Mathematica C header file. Mathematica uses a macro to tell you which version you are using. The format is
#define WSMATHVERSION 10.0.0
I'm more familiar with this pattern of version numbering in macros,
// BOOST_VERSION % 100 is the patch level
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
#define BOOST_VERSION 103900
I like this because it is easier to check whether the version number is greater than a particular version. Is there a canonical way to use the Mathematica style? I find too many decimal points in number
type errors etc. I'm using C but C++ only solutions may be interesting too.