获取G++版本编辑器版本
#include <iostream>
#include <sstream>
using namespace std;
std::string ver_string(int a, int b, int c) {
std::ostringstream ss;
ss << a << '.' << b << '.' << c;
return ss.str();
}
int main() {
std::string true_cxx =
#ifdef __clang__
"clang++";
#else
"g++";
#endif
std::string true_cxx_ver =
#ifdef __clang__
ver_string(__clang_major__, __clang_minor__, __clang_patchlevel__);
#else
ver_string(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#endif
cout << true_cxx_ver << endl;
return 0;
}
查看评测姬配置
#include <stdint.h>
#include <iostream>
#include <cpuid.h>
using namespace std;
static void cpuid(uint32_t func, uint32_t sub, uint32_t data[4]) {
__cpuid_count(func, sub, data[0], data[1], data[2], data[3]);
}
int main() {
uint32_t data[4];
char str[48];
for(int i = 0; i < 3; ++i) {
cpuid(0x80000002 + i, 0, data);
for(int j = 0; j < 4; ++j)
reinterpret_cast<uint32_t*>(str)[i * 4 + j] = data[j];
}
cout << str;
}