Size of C/C++ data type from GNU GCC/g++ compiled ELF 64-bit LSB executable, AMD x86-64 vs. ELF 32-bit LSB executable, Intel 80386
tom peng
tompeng@microsoft.com
Tue Jun 19 07:30:00 GMT 2007
Hi Andrew,
Thanks for correcting my typo on "signed long int 4 8".
The problem I have here is about simulating a hardware model in C/C++. The
hardware model development was based on 32-bit CPU originally. We had
presumed "signed long int" as 32-bit/4 byte length -- as specified in C/C++
code "typedef signed long int int32".
It is apparent that this "int32" in 64-bit ELF executable is of length 8
bytes, not what we expect. It "might" cause the hw simulation inconsistency
when running in 64 vs. 32 ELF format.
I hope to get a generic picture about the size difference of C/C++ data type
and their modifiers in 32/64 ELF format compiled by GCC.
Are those 32-bit / 64-bit difference stipulated in C/C++ standard or ruled
by the GNU/GCC compiler?
Thank you very much,
Tom
Andrew Haley-5 wrote:
>
> tom peng writes:
> >
> > I posted this message on gcc/bug forum earlier. I repost the same
> contents
> > here. I need experts to shed light on C/C++ data type size
> inconsistencies
> > when running 64-bit and 32-bit ELF executables compiled by GNU/GCC
> g++/gcc
> >
> > Following are results of C/C++ data type size from code " cout << "data
> > type" << sizeof(data type) << endl " :
> >
> > | 32-bit | 64-bit
> > -------------------------------
> > int | 4 | 4
> > -------------------------------
> > long int | 4 | 8
> > -------------------------------
> > signed long int | 4 | 4
>
> No, that should be 4 8
>
> > -------------------------------
> > ulong | 4 | 8 (sys/types.h)
> > -------------------------------
> > long double | 12 | 16
>
> Seems OK otherwise. What's your problem?
>
> Andrew.
>
>
--
View this message in context: http://www.nabble.com/Size-of-C-C%2B%2B-data-type-from-GNU-GCC-g%2B%2B-compiled-ELF-64-bit-LSB-executable%2C-AMD-x86-64-vs.-ELF-32-bit-LSB-executable%2C-Intel-80386-tf3942845.html#a11186993
Sent from the gcc - Help mailing list archive at Nabble.com.
More information about the Gcc-help
mailing list