[fpc-pascal] Problem with FPC2.0.2 and windows

Hans Mårtensson cirkulation at maartensson.net
Wed Jan 4 21:51:39 CET 2006

Jonas Maebe wrote:

> On 04 Jan 2006, at 17:51, Hans Mårtensson wrote:
>> Does PPC 2.0.2 handle alignment of data the same way as former  
>> versions?
> The statements below have nothing to do with alignment.
>> Will the statements (the conditions)
>>  if (dword(pBoxtemplate) and 1)=1 then pBoxtemplate:=nil;
> I can only think of one way to interpret this.
>>  if (dword(pBoxtemplate) and 2)=2 then inc(pBoxtemplate);

The type of pBoxtemplate is ^word.
Is it not true that
  (dword(pBoxtemplate) and 1)=1
evaluates to TRUE, if and only if pBoxtemplate is NOT aligned to a word 
boundary (16 bit boundary)?

And then, assuming pBoxtemplate is aligned to word boundary, is it not 
true, that
  if (dword(pBoxtemplate) and 2)=2
evaluates to TRUE, if pBoxtemplate is NOT aligned to a dword boundary 
(32 bit boudary), causing the statement
  if (dword(pBoxtemplate) and 2)=2 then inc(pBoxtemplate);
to make the pBoxtemplate align to a dword boundary (by eventually adding 
2 to pBoxtemplate (because sizeof(word)=2)??

Hans Mårtensson

More information about the fpc-pascal mailing list