Press enter to see results or esc to cancel.

Pointer Operations

Pointer operations are similar to Integer operations. However, only extended Turbo Pascal syntax allows pointer operations other than equality check.

  Procedure CheckPointerOperations;
  begin
    Case Operation of
      Calc_IsEqual,
      Calc_IsNotEqual: Exit;
      else begin
             If not (ExtendedSyntax in ModuleCompilerSwitches) then Error (OperandTypesDoNotMatchOperator);
             If LeftExpression.TypeDefPtr <> Ptr (SystemUnitSegment, PChar_TypeOffset) then
               Error (OperandTypesDoNotMatchOperator);
             If Operation = Calc_Subtract then LeftExpression.TypeDefPtr := Ptr (SystemUnitSegment, LongInt_TypeOffset);
             LeftExpression.DataType := itWord;
             RightExpression.DataType := itWord;
           end;
    end;
  end;

  Procedure ConstantPointerOperations;
  begin
    CheckPointerOperations;
    ConstantIntegerOperations;
  end;

  Procedure GenerateCodeForPointerOperations;
  begin
    CheckPointerOperations;
    GenerateCodeForIntegerOperations;
  end;