Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tutorials:lang:c_standard_macro [2020/05/30 08:20] (current)
alanzheng created
Line 1: Line 1:
 +<​code>​
 +int main() {
 +    if (__cplusplus == 201703L) std::cout << "​C++17\n";​
 +    else if (__cplusplus == 201402L) std::cout << "​C++14\n";​
 +    else if (__cplusplus == 201103L) std::cout << "​C++11\n";​
 +    else if (__cplusplus == 199711L) std::cout << "​C++98\n";​
 +    else std::cout << "​pre-standard C++\n";​
 +}
  
 +#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
 +     //​C++17 specific stuff here
 +#endif
 +</​code>​