Reputation: 171
As the size of the types is not close in the standars of C, if not that there are a maximum and minimum size for them, I would like to know where I can find how gcc interpret this.
Where is in gcc documentation the size of the types they will take? Is there specify? I can not find that information, so i would like a few of help with it.
Thanks in advance.
--- Conclusions ---
Looking into all your comments, I finally get the information in this links to argue the answer
5.2.4.2.1 Sizes of integer types : http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1336.pdf
http://gcc.gnu.org/onlinedocs/gccint/Type-Layout.html
Upvotes: 4
Views: 5128
Reputation: 133919
As per what others said you can see limits.h. However the better way to do yourself is to say what you mean. Thus #include <stdint.h>
and then you can use
int32_t
for exactly 32 bitsint_fast32_t
for the fastest datatype that has at least 32 bitsHowever, if you want to store an array offset you should use size_t
or ssize_t
; likewise for an integer datatype that is big enough to store a pointer, use intptr_t
.
Upvotes: 3
Reputation: 37208
It's not in the GCC documentation per se, but rather in the ABI documentation for each target system. E.g. for Linux x86_64 the ABI document is here: http://www.x86-64.org/documentation/abi.pdf
Details of each ABI that GCC supports is of course coded in the GCC sources, see e.g. chapter 17 in the GCC internals manual at http://gcc.gnu.org/onlinedocs/gccint/Target-Macros.html
Upvotes: 4
Reputation: 1977
For the minimum and maximum values, you can look in limits.h (or the equivalent in C99 and beyond - stdint.h, which includes limits.h).
For the sizes of a type, just use sizeof();
Upvotes: 2