C中的整数尺寸 [英] Size of an Integer in C

查看:136
本文介绍了C中的整数尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问ANSI C标准要求 INT 的大小等于系统的字大小(32位/ 64位)?

Does the ANSI C specification call for size of int to be equal to the word size (32 bit / 64 bit) of the system?

在换句话说,我可以破译的基础上分配给空间系统的字大小 INT

In other words, can I decipher the word size of the system based on the space allocated to an int?

推荐答案

INT 类型的大小是依赖于实现的,但不能短于16位。请参阅最低极限值部分这里

The size of the int type is implementation-dependent, but cannot be shorter than 16 bits. See the Minimum Type Limits section here.

的Linux内核开发网站的索赔中的类型的大小是保证机器的字大小,但这种说法很可能是假的:我再也找不到任何的确认标准和宽只有32位Win64上系统(因为这些系统使用 LLP64 数据模型)。​​

This Linux kernel development site claims that the size of the long type is guaranteed to be the machine's word size, but that statement is likely to be false: I couldn't find any confirmation of that in the standard, and long is only 32 bits wide on Win64 systems (since these systems use the LLP64 data model).

这篇关于C中的整数尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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