[fpc-devel] DOM patch
Dariusz Mazur
darekm at emadar.com
Fri Aug 28 13:25:30 CEST 2009
Jonas Maebe pisze:
>
> On 28 Aug 2009, at 13:10, Dariusz Mazur wrote:
>
>>> - Using PtrInt for doing pointer math is discouraged in favor of
>>> PtrUInt;
>>>
>> I've changed PtrInt do PtrUInt, but its not possible in each place
>>
>> how to resolve
>> tClass= tClass(PtrUInt +ptrInt)
>>
>> FPC claim: combined unsigned and signed make result 64bit, which is
>> incompatible with pointer
>>
>> what is proper way to resolve this
>
> Cast the ptruint to pointer (although I don't know whether this is
> Delphi-compatible).
I know this, but it look strange
FCurrBlock := TDOMNode(pointer(ptrUInt(ext) + sizeof(TExtent) +
(AElemCount - 1) * FElementSize));
I can change FElementSize and AElemCount to longword
but result sizeof is integer
much better look
FCurrBlock := TDOMNode(ptrInt(ext) + sizeof(TExtent) + (AElemCount - 1)
* FElementSize);
or
ptrUInt( FCurrBlock) := ptrUInt(ext) + sizeof(TExtent) + (AElemCount -
1) * FElementSize;
which is proper?
--
Darek
More information about the fpc-devel
mailing list