"sizeof" get unwanted result

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

 



hi,
   i use "sizeof" to get the size of a struct ,defined as:
   typedef struct _A {
     long data1;
     unsigned short data2;
     long  data3;
   }A;
 i guess the sizeof(A) should be 10 .however when i compile and print the
value of "sizeof(A)" ,the reult is 12!!
 so where's the extra 2 bytes? how can i get the gcc to calculate the
desired size ??
an aligned issue??



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux