From 5a25ebb9526d6e191d23ddf0605914b9169b93b9 Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Tue, 17 Mar 2026 15:26:48 +0000 Subject: [PATCH] Use Cpp::GetLanguageStandard to get language standard --- src/xinterpreter.cpp | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/src/xinterpreter.cpp b/src/xinterpreter.cpp index 74358e57..0c9f15b4 100644 --- a/src/xinterpreter.cpp +++ b/src/xinterpreter.cpp @@ -75,33 +75,6 @@ namespace xcpp xeus::register_interpreter(this); } - static std::string get_stdopt() - { - // We need to find what's the C++ version the interpreter runs with. - const char* code = R"( -int __get_cxx_version () { -#if __cplusplus > 202302L - return 26; -#elif __cplusplus > 202002L - return 23; -#elif __cplusplus > 201703L - return 20; -#elif __cplusplus > 201402L - return 17; -#elif __cplusplus > 201103L || (defined(_WIN32) && _MSC_VER >= 1900) - return 14; -#elif __cplusplus >= 201103L - return 11; -#else - return 0; -#endif - } -__get_cxx_version () - )"; - auto cxx_version = Cpp::Evaluate(code); - return std::to_string(cxx_version); - } - interpreter::interpreter(int argc, const char* const* argv) : xmagics() , p_cout_strbuf(nullptr) @@ -111,7 +84,7 @@ __get_cxx_version () { //NOLINTNEXTLINE (cppcoreguidelines-pro-bounds-pointer-arithmetic) createInterpreter(Args(argv ? argv + 1 : argv, argv + argc)); - m_version = get_stdopt(); + m_version = Cpp::GetLanguageStandard(nullptr); redirect_output(); init_preamble(); init_magic();