小编19U*_*9UV的帖子

无法在 C++ 中将 64 位数字分配给 64 位最小值

我是 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)

我错过了一些明显的东西吗?

c++ 64-bit

4
推荐指数
1
解决办法
104
查看次数

标签 统计

64-bit ×1

c++ ×1