任何保证最小尺寸在C类型? [英] Any guaranteed minimum sizes for types in C?

查看:94
本文介绍了任何保证最小尺寸在C类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能通常做任何假设有关数据类型的最小尺寸?

Can you generally make any assumptions about the minimum size of a data type?

我到目前为止阅读:


  • 字符:1个字节

  • 短:2字节

  • INT:2字节,通常为4个字节

  • 长:4字节

浮动?双???

在值 float.h时 limits.h中系统相关的?

推荐答案

这是盖在的维基百科的文章

一个短整型必须不大于int。

A short int must not be larger than an int.

这是INT不得超过一个长整型大。

An int must not be larger than a long int.

一个短整型必须至少有16位长。

A short int must be at least 16 bits long.

一个int必须至少16位长。

An int must be at least 16 bits long.

一个长整型必须至少有32位长。

A long int must be at least 32 bits long.

一个得到long long int必须至少64位。

A long long int must be at least 64 bits long.

该标准不要求任何这些尺寸是必然不同。它是完全有效的,例如,如果所有的四种类型是64位长。

The standard does not require that any of these sizes be necessarily different. It is perfectly valid, for example, if all four types are 64 bits long.

这篇关于任何保证最小尺寸在C类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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