[fpc-pascal] How to solve "Conversion between ordinals and pointers is not portable"

Tomas Hajny XHajT03 at mbox.vol.cz
Wed Nov 18 12:40:44 CET 2009

On Tue, November 17, 2009 10:48, Graeme Geldenhuys wrote:
> dmitry boyarintsev wrote:
>> procedure XorBlock(var InData1, InData2; Size: longword);
>> var
>>   b1 : PByte;
>>   b2 ; PByte;
> Changing those declarations to PByteArray type solves the compiler error
> in FPC.
> var
>   b1: PByteArray;
>   b2: PByteArray;

I suggest being careful with PByteArray, or at least make sure that you
know the type definition and you know where this definition comes from.
First, it is certainly very different from PByte regarding the supported
range. PByte allows addressing the complete memory space, PByteArray is
limited (well, at least it is if you turn range checking on ;-) ).
Moreover, PByte is defined in unit system and is thus common for all FPC
programs, whereas there are several different definitions for PByteArray
in the FPC RTL, out of which at least two are in common (cross-platform)
units (in particular SysUtils and Objects), and there's a lot of other
(3rd party / user) code containing other definitions of P/TByteArray.


More information about the fpc-pascal mailing list