> Why it returns 16 instead of 15?
> It is because the data is aligned to word or double-word boundaries for 
> faster access?

Yes, it is.

> How do I get the real size then?

Cancel align;ent using "packet" keyword:

TSample = packed record                        
....
end;

--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be



----- Original Message ----- 
From: "CubicDesign" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, May 16, 2007 5:19 PM
Subject: problems with SizeOf


> Hi.
> Can anybody tell me what should return this function Sizeof(TSample)?
> 
> TSample = record                        
>    SampleA: 
> Smallint;                                                         
>    SampleB: 
> Smallint;                                                         
>    SampleC: Smallint;
>    SampleD: Smallint;
>    BasePos: Integer;                    
>    Base  : 
> char;                                                           
>    QV     : BYTE;
>    Gray   : Boolean;
>  end;              {Size= 2+2+2+2+ 4+ 1+ 1+ 1}
> 
> Why it returns 16 instead of 15?
> It is because the data is aligned to word or double-word boundaries for 
> faster access?
> How do I get the real size then?
> 
> 
> 
> 
> I want to save a matrix called CromaMX (CromaMX = array of TSample ) to 
> disk using BlockWrite. How do I save it, without wasting disk space, 
> because it looks that if I use:
> 
>  SizeChroma= Length(CromaMX)* sizeof(TSample);
>  BlockWrite(F, CromaMX[0],  SizeChroma);          
> 
> I will allocate too much space.
> 
> 
> 
> 
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to