On Mon, October 1, 2012 10:43, dhkblas...@zeelandnet.nl wrote:
Hi, > I want to ask if casting an integer to a pointer is valid > over all platforms. See below: > > p: PInteger; > v: longint; > > [...] > > v := > 4235423; > > p := PInteger(v); > > Of course, the value of the pointer > adress may vary, but in general is this a valid way to assign a pointer? > Or will some platforms or architecture give problems? Use PtrInt (signed) or PtrUInt (unsigned) types instead of longint, etc. The former two are guaranteed to work for all architectures and platforms. Your particular example fails on all 64-bit architectures (among others) immediately. Tomas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal