sizeof(short int)不分割sizeof(int)的实现 [英] An implementation where sizeof(short int) does not divide sizeof(int)

查看:92
本文介绍了sizeof(short int)不分割sizeof(int)的实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你有一个实现的例子

sizeof(short int)不分割sizeof(int)或

sizeof(int)不分割sizeof( long int)或

sizeof(long int)不分割sizeof(long long int)?


相应的无符号类型的相同问题。

Do you have an example of an implementation where
sizeof(short int) does not divide sizeof(int) or
sizeof(int) does not divide sizeof(long int) or
sizeof(long int) does not divide sizeof(long long int) ?

Same question for the corresponding unsigned types.

推荐答案

Spiros Bousbouras写道:
Spiros Bousbouras wrote:

你有一个实现的例子吗?其中

sizeof(短整数)不分割sizeof(int)或

sizeof(int)不分割sizeof(long int)或

sizeof(long int)不分割sizeof(long long int)?


相应的无符号类型的相同问题。
Do you have an example of an implementation where
sizeof(short int) does not divide sizeof(int) or
sizeof(int) does not divide sizeof(long int) or
sizeof(long int) does not divide sizeof(long long int) ?

Same question for the corresponding unsigned types.



怎么样......

长期有40个值位的实现...(TI DSPs)

一个实现,其中sizeof(long double)== 10或== 12 ...(IEEE

754标准版)

What about...

An implementation where long has 40 value bits... (TI DSPs)
An implementation where sizeof (long double) == 10 or == 12... (IEEE
754 Standard)


" Spiros Bousbouras" < sp **** @ gmail.comwrote in message

news:11 ********************* @ v45g2000cwv.googlegro ups .com ...
"Spiros Bousbouras" <sp****@gmail.comwrote in message
news:11*********************@v45g2000cwv.googlegro ups.com...

你有一个实现的例子

sizeof(short int)不分割sizeof(int)或者

sizeof(int)不分割sizeof(long int)或

sizeof(long int)不分割sizeof(long long int)?


相应的无符号类型的相同问题。
Do you have an example of an implementation where
sizeof(short int) does not divide sizeof(int) or
sizeof(int) does not divide sizeof(long int) or
sizeof(long int) does not divide sizeof(long long int) ?

Same question for the corresponding unsigned types.



有趣的问题,但可能与实际编程无关。


计算机进化的意外是你的关系

寻求存在的例外。我不知道为什么在这个世界上你不能轻易找到一台有40位整数或48位整数的计算机。


Counteroffer:你能告诉我一个糟糕的''C'实现,如果你提到的关系不成立,那将会失败吗?我也没见过。


-

David T. Ashley(dt *@e3ft.com)
http://www.e3ft.com (咨询主页)
http://www.dtashley.com (个人主页)
http://gpl.e3ft.com (GPL出版物和项目)

Interesting question, but probably irrelevant to actual programming.

It is an accident of computer evolution that the relationships you are
seeking an exception to exist. I have no idea why in the world one can''t
easily find a computer with 40-bit integers or 48-bit integers, for example.

Counteroffer: can you show me a poor ''C'' implementation that will fail if
the relationships you mention don''t hold? I''ve never seen that, either.

--
David T. Ashley (dt*@e3ft.com)
http://www.e3ft.com (Consulting Home Page)
http://www.dtashley.com (Personal Home Page)
http://gpl.e3ft.com (GPL Publications and Projects)


Spiros Bousbouras写道:
Spiros Bousbouras wrote:

你有一个实现的例子

sizeof(short int)不分割sizeof (int)或

sizeof(int)不分割sizeof(long int)或

sizeof(long int)不分割sizeof(long long int)?
Do you have an example of an implementation where
sizeof(short int) does not divide sizeof(int) or
sizeof(int) does not divide sizeof(long int) or
sizeof(long int) does not divide sizeof(long long int) ?



不,但是我使用了两个sizeof(int)不分割

sizeof(double)[分别为4和10]。

No, but I have used two where sizeof(int) does not divide
sizeof(double) [4 and 10 respectively.]


相应的无符号类型的相同问题。
Same question for the corresponding unsigned types.



是的,这是同一个问题。有符号整数的大小

必须与相应的

无符号类型的大小相同。


但为什么是你关心大小?这是常见的

误认为大小比价值更重要。

[以任何你想要的方式阅读。]另一种流行的

误解是_where_一个对象位于

比_when_存在更重要。


-

彼得

Yes, it is the same question. The size of a signed integer
is necessarily the same as the size of the corresponding
unsigned type.

But why are you concerned about size? It''s a common
misconception that size is more important than value.
[Read that any way you want.] Another popular
misconception is that _where_ an object is located is
more important than _when_ it exists.

--
Peter


这篇关于sizeof(short int)不分割sizeof(int)的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆