Re: [fpc-pascal] Pointer question

2023-08-09 Thread Tomas Hajny via fpc-pascal
On August 10, 2023 at 0:06:57 +0200, Hairy Pixels via fpc-pascal wrote: >> On Aug 9, 2023, at 2:54 PM, Tomas Hajny via fpc-pascal >> wrote: >> >>> >>> 1) what does "i := x - x;" do and what is it's purpose and why doesn't "x + >>> x" work the same? >> >> Pointer subtraction is a reverse ope

Re: [fpc-pascal] Pointer question

2023-08-09 Thread Hairy Pixels via fpc-pascal
> On Aug 9, 2023, at 2:54 PM, Tomas Hajny via fpc-pascal > wrote: > >> >> 1) what does "i := x - x;" do and what is it's purpose and why doesn't "x + >> x" work the same? > > Pointer subtraction is a reverse operation to adding a number to a pointer; > the result of the subtraction is the

Re: [fpc-pascal] Pointer question

2023-08-09 Thread Tomas Hajny via fpc-pascal
On August 9, 2023 at 22:14:17 +0200, Hairy Pixels via fpc-pascal wrote: >Playing around I had a more questions about pointer operations I've never used >myself. > >1) what does "i := x - x;" do and what is it's purpose and why doesn't "x + x" >work the same? Pointer subtraction is a reverse op

Re: [fpc-pascal] Pointer question

2023-08-09 Thread Hairy Pixels via fpc-pascal
Playing around I had a more questions about pointer operations I've never used myself. 1) what does "i := x - x;" do and what is it's purpose and why doesn't "x + x" work the same? 2) I've used pointer equality of course but what does "x > p" do and what is its purpose? === var

Re: [fpc-pascal] Pointer question

2023-08-09 Thread Hairy Pixels via fpc-pascal
> On Aug 8, 2023, at 11:53 PM, Sven Barth via fpc-pascal > wrote: > > By default @ returns a *untyped* pointer that can be assigned to any pointer > type. Thus is compatible with Delphi and can be controlled with the > $TypedAddress directive (there's a slight exception to this when you ass