[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: amd64: why is sizeof(int) =4? why not =8?

On Wed, 2006-04-05 at 06:48 -0500, Mitchell Laks wrote:
> Hi,
> I wanted to find out more about amd64, so I installed the debian distro 

Did you install the 64 bit version?

> (etch/sid) on my amd64 dual core system. 

Which one?  Etch or Sid?

> I wanted to see if it is really 64 bit. So naively i compiled the following 
> example program I found on the internet:
> Size of double is 8
> So how do I see the 64 bittness of the operating system if  not this way with 
> gcc? I would think tha size of int would be 8?
> uname -a
> Linux Rashi #1 SMP Wed Apr 5 13:34:46 EDT 2006 
> x86_64 GNU/Linux

If you did actually install the 64 bit build, do a sizeof(int *) 
and you'll see that it is 64 bits.

AMD decided that, to help with compatibility with s/w written when
sloppy programmers assumed that sizeof(int) == sizeof(*), integers
will be 32 bits, even in 64 bit mode.

64 bit integers are of type "long long" and int64, which are just
different names for the same type.

Ron Johnson, Jr.
Jefferson, LA USA

"Politicians are the same all over. They promise to build a
bridge where there is no river."
Nikita Krushchev

Reply to: