gpt4 book ai didi

c - 是否可以使用 32 位编译器实现 64 位整数?

转载 作者:太空宇宙 更新时间:2023-11-03 23:34:30 24 4
gpt4 key购买 nike

虽然已经有很多关于堆栈溢出的问题(几乎接近我想知道的)。但是这些人都没有得到可以解决此案的答案。

我的问题基本上是关于以下内容:

Is it possible to implement 64-bit integers using a 32-bit compiler? What is the significance of bit-size of compiler in deciding size of integer? (not considering performance issues)

已经提出的一些相关问题是:

  1. integer size in c depends on what?

  2. Does the size of an int depend on the compiler and/or processor?

  3. What does the C++ standard state the size of int, long type to be?

上面的每个问题都有一些很好的答案,但最后,他们都没有给我一个准确的答案。

最佳答案

int64_t 是 64b 整数类型,如果包含 stdint.h 则可用。uint64_t 是未签名版本,在同一 header 中定义。

参见 Are types like uint32, int32, uint64, int64 defined in any stdlib header?了解更多详情。

Is it possible to implement 64-bit integers on a 32-bit machine? (not considering performance issues)

当然。通常没有必要,除非你在一个非常有限的指令集上,但这绝对是可能的。 How to implement big int in C++解释了如何处理任意精度整数,这是一个非常难解决的问题。

关于c - 是否可以使用 32 位编译器实现 64 位整数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7619981/

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