我是 C++ 的新手,如果这听起来像一个愚蠢的问题,我很抱歉。我正在尝试将 64 位最小值 (-9223372036854775808) 分配给 int64_t(来自 cstdint),但是我收到了当前的错误消息:
main.cpp:5:27: warning: integer literal is too large to be represented in a signed integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]
int64_t int_64_min = -9223372036854775808;
Run Code Online (Sandbox Code Playgroud)
代码如下:
#include <iostream>
#include <cstdint>
int main() {
int64_t int_64_min = -9223372036854775808;
std::cout << int_64_min << std::endl;
std::cout << INT64_MIN << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我错过了一些明显的东西吗?