0

What's a good/best way to toggle some function declarations based on VS version?

context: I need to build on linux and windows and keep hitting cases where GCC compiles fine but VS2012 lacks some c++11 features. I'd like to #ifdef out the unsupported syntax so that it can be used right now on linux and easily enabled later for VS2013 support.

features like default function template parameters are supposedly good with vs2013: http://blogs.msdn.com/b/vcblog/archive/2013/06/27/what-s-new-for-visual-c-developers-in-vs2013-preview.aspx

 //syntax fail; can this be wrapped with "If GCC or VSVERSION > XYZ" ?
 template <typename T/*=std::complex<double>*/>  void setImpedance(T impedance);
peter karasev
  • 2,578
  • 1
  • 28
  • 38
  • 2
    Possible duplicate of http://stackoverflow.com/questions/1233435/detect-compiler-with-ifdef. See also [this link](http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros). – Constructor Jan 20 '14 at 12:07
  • ok, your link answers how to whip it up and gives a great summary of the compiler versions: _MSC_VER contains the major and minor version numbers as an integer (e.g. "1500" is version 15.00). _MSC_FULL_VER contains the major version, minor version, and build numbers as an integer (e.g. "150020706" is version 15.00.20706). – peter karasev Jan 20 '14 at 22:58

0 Answers0