[fpc-pascal] Misleading Statement at Comparison Operator Description

Daniel Gaspary dgaspary at gmail.com
Tue Aug 25 19:18:36 CEST 2015


Hi,

   I believe the statement[1] bellow is not accurate:

   "The result type of a comparison operator is always a boolean."

   Because this code compiles and works:


program Project1;
type
    TMyType1 = class(TObject);
    TMyType2 = class(TObject);
    TMyType3 = class(TObject);

    operator > (t1: TMyType1; t2: TMyType2): TMyType3;
    begin
         //some code...
    end;

var
   t3: TMyType3;
begin
     t3:=TMyType1.Create > TMyType2.Create;
end.

Am I Wrong, the documentation need fixing.. ?

Thank you.

[1] http://www.freepascal.org/docs-html/ref/refse93.html#x198-20800015.5



More information about the fpc-pascal mailing list