Re: Packed/padded structs and pointer arithmetic

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

 



On Saturday 07 April 2007 15:44, John Anthony Kazos Jr. wrote:

> 
> struct foo {
> 	short int quux;
> 	short int quuux;
> } ;
> 
> ...could be actually eight bytes long, and doing this...
> 

At least for Unices and Windows a short int is always 2 bytes on both 32bit and 64bit machines. And is always aligned at a 2 byte boundary.

I think that the below table already circulated the list, but here it is again:

OS                    char     short      int         long       void*
Unix 32bit         1 byte  2 bytes  4 bytes  4 bytes  4 bytes
Windows 32bit  1 byte  2 bytes  4 bytes  4 bytes  4 bytes
Unix 64bit         1 byte  2 bytes  4 bytes  8 bytes  8 bytes
Windows 64bit  1 byte  2 bytes  4 bytes  4 bytes  8 bytes


Regards,
tavi


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux