64,281
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
constexpr bool IsX64Fun() {
return 8 == sizeof(void *);
}
constexpr bool IsX64 = IsX64Fun();
int main() {
#if IsX64
std::cout << "我是x64" << std::endl;
#else
std::cout << "我是x86" << std::endl;
#endif
}
#include <iostream>
constexpr bool IsX64 = true;
int main() {
std::cout << IsX64 << std::endl;
#if IsX64
std::cout << "我是x64" << std::endl;
#else
std::cout << "我是x86" << std::endl;
#endif
}