尺寸长 [英] Size of long
问题描述
我知道C ++ Standard并没有对
_long_ type的大小强加任何要求。我想知道_long_在现实中的大小是多少?我不认为
有1字节_long_的架构。我认为,_long_最可能的
大小将是4个字节。 2字节_long_怎么样,有这么大的
架构吗?
谢谢,
Nikolai Borissov
I know that C++ Standard does not impose any requirements for the size of
_long_ type. I wonder what is the size of _long_ in reality? I don''t think
that there are architectures with 1-byte _long_. I think, the most probable
size for _long_ would be 4 bytes. What about 2-byte _long_, are there any
architectures with that size?
Thanks,
Nikolai Borissov
推荐答案
Nikolai Borissov写道:
Nikolai Borissov wrote:
我知道C ++标准没有对
_long_类型。我想知道_long_在现实中的大小是多少?
I know that C++ Standard does not impose any requirements for the size of
_long_ type. I wonder what is the size of _long_ in reality?
你的意思是什么在现实中?这取决于实施/
系统。只做一个cout<<的sizeof(长);并查找你的系统。
我的系统,长4 MB。
- 核/实验室 -
>
" Nikolai Borissov" < N ******** @ sympatico.ca>。 skrev i melding
新闻:J9 ******************* @ news20.bellglobal.com ..。
"Nikolai Borissov" <n.********@sympatico.ca> skrev i melding
news:J9*******************@news20.bellglobal.com.. .
我知道C ++ Standard并没有对
_long_ type的大小提出任何要求。我想知道_long_在现实中的大小是多少?我不认为有一个1字节_long_的架构。我认为,_long_的最大
可能大小将是4个字节。 2字节_long_怎么样,有这么大的架构吗?
谢谢,
Nikolai Borissov
I know that C++ Standard does not impose any requirements for the size of
_long_ type. I wonder what is the size of _long_ in reality? I don''t think
that there are architectures with 1-byte _long_. I think, the most probable size for _long_ would be 4 bytes. What about 2-byte _long_, are there any
architectures with that size?
Thanks,
Nikolai Borissov
>
AFAIK你不能保证你的情况下长型的大小,保证这是什么类型的最小尺寸,这个类型的最小尺寸是4个字节。很长
类型。 int类型在某些系统上是2个字节,在另一个系统上是4个,你是
但是保证它至少是2个字节。
有人确认这个?
-Magnus
AFAIK you have no guarantee on the size of the long type in your case, what
is guaranteed is the minimum size of this type, wich is 4 bytes for the long
type. The int type is 2 bytes on some systems and 4 on others, you are
however guaranteed that it is at the minimum 2 bytes.
Could someone confirm this ?
-Magnus
Magnus写道:
Magnus wrote:
AFAIK你没有在你的情况下保证long类型的大小,
保证的是这种类型的最小大小,对于
long类型,这是4个字节。 int类型在某些系统上是2个字节,在其他系统上是4个,但是你可以保证它至少是2个字节。
如果标准保证最少4个字节,这将是非常好的。
我只有标准草案而且找不到任何标准具体信息
关于_long_类型。关于便携性的这一点。
有人可以证实吗?
AFAIK you have no guarantee on the size of the long type in your case, what is guaranteed is the minimum size of this type, wich is 4 bytes for the long type. The int type is 2 bytes on some systems and 4 on others, you are
however guaranteed that it is at the minimum 2 bytes.
If minimum of 4 bytes is guaranteed by the Standard it would be excellent.
I''ve got only Draft Standard and couldn''t find any specific information
about _long_ type. This whole point about portability.
Could someone confirm this ?
有人是标准的真正专家,请回复。 />
Nikolai Borissov
Someone who is the true expert in the Standard, please respond.
Nikolai Borissov
这篇关于尺寸长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!