gpt4 book ai didi

c - 类型如何保证位宽?

转载 作者:太空宇宙 更新时间:2023-11-04 01:16:08 26 4
gpt4 key购买 nike

由于 C 是一种松散类型的语言并且 stdint.h 只定义了 typedefs(我假设),如何保证 int 的宽度?

我要问的是实现而不是库的使用。

最佳答案

How can <stdint.h> types guarantee bit width?

C 不能,C 也不需要。

C 确实需要最小 宽度。


下面的个性化仅在支持它们的系统上是必需的,没有填充和符号类型的 2 的补码。

(u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t

一个实现可以选择其他大小,比如 uint24_t

以下为必填项。

(u)int_least8_t, (u)int_least16_t, (u)int_least32_t, (u)int_least64_t

关于c - <stdint.h> 类型如何保证位宽?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58667615/

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