Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save johnmcfarlane/b519528f22a26584948a77b47dba2c7b to your computer and use it in GitHub Desktop.
Save johnmcfarlane/b519528f22a26584948a77b47dba2c7b to your computer and use it in GitHub Desktop.
Script for printing compiler version and language revision as a diagnostic
template <int c, long s> struct _;
#if defined(__clang__)
_<__clang_major__, __cplusplus> clang_version_and_standard;
#elif defined(__GNUC__)
_<__GNUC__, __cplusplus> gcc_version_and_standard;
#elif defined(_MSC_VER)
_<_MSC_VER, __cplusplus> msvc_version_and_standard;
#else
#error "I don't know that compiler"
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment