C / C ++:内置类型各种编译器/平台的尺寸 [英] C/C++: Size of builtin types for various compilers/platforms
问题描述
我在哪里可以得到有关的,比如说, unsigned int类型
在 GCC编译
尺寸为Mac信息OS X(32和64位)?总的来说,我很想有一个资源我可以去一个编译器/设置/平台/类型,能够查找该类型将有多大。有谁知道这样的事?
Where can I go to get information about the size of, say, unsigned int
compiling under gcc
for Mac OS X (both 32 and 64 bits)? In general I'd love to have a resource I can go to with a compiler/settings/platform/type and be able to look up how big that type will be. Does anyone know of such a thing?
更新:感谢所有的反应。我希望能有沿静态表而不是某个位置的一片code的线条更东西,我不得不写,每一个机器上运行。
Update: Thanks for all the responses. I was hoping to have something more along the lines of a static table somewhere instead of a piece of code I'd have to write and run on every machine.
推荐答案
如果你不能写一个程序找出来,您应该咨询编译器/平台ABI(应用程序二进制接口)规范。它应该记录的大小,对齐,字节顺序,基本的原始类型等的支持。
If you can't write a program to find out, you should consult the ABI (Application Binary Interface) specification for the compiler/platform. It should document the sizes, alignments, endianness, etc. of the basic primitive types supported.
这篇关于C / C ++:内置类型各种编译器/平台的尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!