This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
data type sizes
- From: "k wayne" <pleexed at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 17 Oct 2007 22:07:39 +0200
- Subject: data type sizes
hi,
i'd like to define preprocessor macros (for g++) that tell me the size
of the fundamental data types in bits, so i can use them in
preprocessor directives like in this example:
#if SIZE_OF_UNSIGNED_LONG > 32
i could detect whether the compilation is done by gcc/g++, detect the
gcc version, the CPU architecture and the OS using the predefined
macros of gcc and look up the sizes in some kind of "table" with that
information, but i have been told that this is not everything needed
to determine the sizes (i think it had something to do with the ABI).
is that true? if it is, i'd need a different approach, and i hope you
could help me with that.
oh, and i'd like not to have to use some other tool, like one of the
autotools, to do the work; ideally, everything needed to determine the
data type sizes is in my header/source files.
thank you in advance,
pleexed