多少字节是unsigned long long? [英] How many bytes is unsigned long long?
问题描述
多少字节是 unsigned long long
?
是否与 unsigned long long int
相同?
推荐答案
执行摘要:它是64位或更大。
Executive summary: it's 64 bits, or larger.
无符号长整型
与 unsigned long long int
。它的大小是平台相关的,但由C标准(ISO C99)保证至少为64位。在C89中没有 long long
,但显然甚至MSVC支持它,因此它非常便于移植。
unsigned long long
is the same as unsigned long long int
. Its size is platform-dependent, but guaranteed by the C standard (ISO C99) to be at least 64 bits. There was no long long
in C89, but apparently even MSVC supports it, so it's quite portable.
当前C ++标准(2003年发布),没有 long long
,尽管许多编译器支持它作为扩展。即将到来的C ++ 0x标准将支持它,它的大小将与C中相同,因此至少64位。
In the current C++ standard (issued in 2003), there is no long long
, though many compilers support it as an extension. The upcoming C++0x standard will support it and its size will be the same as in C, so at least 64 bits.
您可以获得确切的大小,字节(在典型平台上为8位)与表达式 sizeof(unsigned long long)
。如果你只需要64位,使用< stdint.h>
中定义的 uint64_t
一系列相关类型(在C99,C ++ 11和一些当前C ++编译器中可用)。
You can get the exact size, in bytes (8 bits on typical platforms) with the expression sizeof(unsigned long long)
. If you want exactly 64 bits, use uint64_t
, which is defined in the header <stdint.h>
along with a bunch of related types (available in C99, C++11 and some current C++ compilers).
这篇关于多少字节是unsigned long long?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!