我想要做的是定义一个等于 2^30 的常数(我可能会将其更改为 2^34 之类的东西,所以我更喜欢有一个大于 32 位的房间)。
为什么以下最小(?)示例无法编译?
#include <stdint.h>
// test.cpp:4:33: error: expected primary-expression before numeric constant
// test.cpp:4:33: error: expected ')' before numeric constant
const uint64_t test = (uint64_t 1) << 30;
//const uint64_t test1 = (uint64_t(1)) << 30;// this one magically compiles! why?
int main() { return 0; }