gpt4 book ai didi

c - 如何在 C 语言中使用 uint64_t

转载 作者:太空狗 更新时间:2023-10-29 15:21:25 30 4
gpt4 key购买 nike

<分区>

#include <stdio.h>
#include <stdint.h>

int main(){
uint64_t a = 1 << 63;
/* do some thing */
return 0;
}

$ gcc -Wall -Wextra -std=c99 test.c -o test  
warning: left shift count >= width of type [-Wshift-count-overflow]

问:uint64_t应该是64位宽度,为什么左移会溢出?

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com