Dear All
Thanks for your cooperation.
Again I am clearly explaining what my problem is.
I have records like below
PASTimeTag = RECORD high : INTEGER; low : INTEGER; END;
meaobj_record = RECORD next : meaobj_pointer; prev : meaobj_pointer; status : INTEGER; timetag : PASTimeTag; value : REAL; END;
meaobj_pointer = ^meaobj_record;
If I print the size of the records using sizeof functions I am getting below results.
sizeof(PASTimeTag) = 8 bytes (*which is correct bcoz INTEGER occupies 4 bytes )
sizeof(meaobj_record) = 32 bytes (*Actually it should be 28 bytes(meaobj_pointer=4+meaobj_pointer=4+ INTEGER=4+PASTimeTag=8+REAL=8)but it is allocating 32 bytes which is multiple of 8 near to 28*)
If I am trying to access real field in the record from the pascal program it is giving 'signal SIGSEGV, Segmentation fault' but it is not happening all the times.In the debug mode I could access all the fields except real variable during the crash.
This is the major problem preventing me to go further since several days.
Please suggest me some solution.
Regards Hari
__________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs
On Mon, 28 Nov 2005, vanam srihari kumar wrote:
Dear All
Thanks for your cooperation.
Again I am clearly explaining what my problem is.
I have records like below
PASTimeTag = RECORD high : INTEGER; low : INTEGER; END;
meaobj_record = RECORD next : meaobj_pointer; prev : meaobj_pointer; status : INTEGER; timetag : PASTimeTag; value : REAL; END;
meaobj_pointer = ^meaobj_record;
If I print the size of the records using sizeof functions I am getting below results.
sizeof(PASTimeTag) = 8 bytes (*which is correct bcoz INTEGER occupies 4 bytes )
sizeof(meaobj_record) = 32 bytes (*Actually it should be 28 bytes(meaobj_pointer=4+meaobj_pointer=4+ INTEGER=4+PASTimeTag=8+REAL=8)but it is allocating 32 bytes which is multiple of 8 near to 28*)
You might try rearanging meaobj_record, puting the 8 byte items first and change integer to longint (8 bytes). Now it's 8+8+8+4+4 = 32 and there's no 4 byte pad hiding in there someplace. Russ
vanam srihari kumar wrote:
Dear All
Thanks for your cooperation.
Again I am clearly explaining what my problem is.
I have records like below
PASTimeTag = RECORD high : INTEGER; low : INTEGER; END;
meaobj_record = RECORD next : meaobj_pointer; prev : meaobj_pointer; status : INTEGER; timetag : PASTimeTag; value : REAL; END;
meaobj_pointer = ^meaobj_record;
If I print the size of the records using sizeof functions I am getting below results.
sizeof(PASTimeTag) = 8 bytes (*which is correct bcoz INTEGER occupies 4 bytes )
sizeof(meaobj_record) = 32 bytes (*Actually it should be 28 bytes(meaobj_pointer=4+meaobj_pointer=4+ INTEGER=4+PASTimeTag=8+REAL=8)but it is allocating 32 bytes which is multiple of 8 near to 28*)
I think you should first read a basic tutorial on data alignment, e.g. http://en.wikipedia.org/wiki/Data_Structure_Alignment.
Regards,
Adriaan van Os