Funny Code in System.Types in RTL and Delphi Object Pascal Posted July 13, 2019 · Edited July 13, 2019 by Ben Grasset Free Pascal's version is just this: class operator TPoint.Explicit (apt: TPoint): TSmallPoint; begin result.x:=apt.x; result.y:=apt.y; end; which simply wraps around if out of range, E.G the following code in FPC: program Example; uses Types; var PA: TPoint; PB: TSmallPoint; begin PA.X := High(SmallInt) + 1; PA.Y := Low(SmallInt) - 1; PB := TSmallPoint(PA); WriteLn(PB.X); WriteLn(PB.Y); end. prints: -32768 32767 Would this not work in Delphi? I can't recall.
Funny Code in System.Types
in RTL and Delphi Object Pascal
Posted · Edited by Ben Grasset
Free Pascal's version is just this:
which simply wraps around if out of range, E.G the following code in FPC:
prints:
Would this not work in Delphi? I can't recall.