|
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); |
|
} |
Defines version for the kernel based on __get_cxx_version and this variable ends up taking 0 for the kernel version (for any C kernel). For example from the wasm kernel (pasting the wasm content)
(func $__get_cxx_version (;2;) (export "__get_cxx_version") (result i32)
i32.const 0
)
So a kernel info request would show the version to be 0 instead of C23.
We should probably fetch information from the Kernel spec whether a C or C++ kernel is defined and use get_stdopt accordingly !
xeus-cpp/src/xinterpreter.cpp
Lines 76 to 101 in c7628c6
Defines version for the kernel based on
__get_cxx_versionand this variable ends up taking0for the kernel version (for any C kernel). For example from the wasm kernel (pasting the wasm content)So a kernel info request would show the version to be 0 instead of
C23.We should probably fetch information from the Kernel spec whether a C or C++ kernel is defined and use get_stdopt accordingly !