[fpc-pascal] Pointer question

Hairy Pixels genericptr at gmail.com
Wed Aug 9 22:14:17 CEST 2023


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
  i: int64;
  x: ^byte;
  p: Pointer;
begin
  i := x - x;
  i := x + x;  // Error: Operator is not overloaded: "^Byte" + "^Byte"

  if x > p then
    ;
end;

Regards,
Ryan Joseph



More information about the fpc-pascal mailing list