size mismatch with unsigned long long

Nitya Narasimhan nitya@alpha.ece.ucsb.edu
Sun Jul 2 13:11:00 GMT 2000


Hi,

I am using gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
on a Sun UltraSPARC II (Solaris2.6)
  
I have a structure as follows
  typedef struct connID{
    unsigned long long ts;
    int connNum;
  }  

This is part of a message header in a network application. 
The problem is that I seem to have some size-mismatch due to the
use of the unsigned long long field.

Using both printf and gdb, I get the following
  size of unsigned long long = 8
  size of int                = 4
  size of connID             = 16
  
Where are the extra 4 bytes coming from? 

If I declare "ts" to be an int field, then the sizes are all
consistent. Its only the use of unsigned long long that causes
this problem. (I have #included sys/types.H to get the definition
of unsigned long long)

Can ANYONE shed some light on this .. unfortunately, this messes
up a lot of the other structures that rely on this struct so I 
really need to fix this.

Thanks
-Nitya


  
_____________________________________________________________________
«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
   ^   /)  _/_          Nitya Narasimhan, Graduate Student Researcher 
  / \ /  . / _    _     Computer Networks & Distributed Systems Lab 
(/   v _/_/_ /_/(_/_    University of California, Santa Barbara.
           ___/         
          (             Email: nitya@alpha.ece.ucsb.edu
                        URL  : http://alpha.ece.ucsb.edu/~nitya
_____________________________________________________________________
«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯



More information about the Gcc mailing list