[fpc-devel] Packed record integers and x86_86

Pierre Muller pierre at freepascal.org
Wed Mar 27 22:11:00 CET 2019

>     _______________________________________________
>     fpc-devel maillist  -  fpc-devel at lists.freepascal.org <mailto:fpc-devel at lists.freepascal.org>
>     http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
> Pointer arithmetic:
> *for Indx := 0 to SizeOf(TTCPPackageHeader) - 1 do Dec(Byte(Pointer(Cardinal(@x) + Indx)^), ARollCount);*
the error has nothing to do with your record,
its that part:
Pointer(Cardinal(@x) + Indx)^)

The problem is that Cardinale is an unsigned 32-bit integer,
while on 64-bit, you will need UINT64,

  You should use PtrUInt type that is an unsigned type
that always have the size of an address instead of cardinal here!


More information about the fpc-devel mailing list