1) what does "i := x - x;" do and what is it's purpose and why doesn't "x + x" 
work the same?

Subtracting pointers may be useful if they point to consecutive memory. The Result is the number of bytes between both addresses.

Adding pointers is useless, you would get a pointer pointing to some address in address space which has no relation to the pointers — presumably accessing it would rise an error.

Therefore, it is a good idea to let the compiler prevent such mistakes.

2) I've used pointer equality of course but what does "x > p" do and what is 
its purpose?

It may be useful if pointers do point into a continuous data object, e.g. a write-pointer inside a buffer.

Elmar


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to