"Result" as return value for operator?
Peter N Lewis
peter at stairways.com.au
Tue Mar 11 14:06:13 CET 2003
It seems to me that there is a delphi extension where the variable
Result can be used for any function return value. Eg:
function sum( a, b: integer ): integer;
Result := a;
Result := Result + b;
Given this, I expected operator to work the same way:
operator + ( a, b: integer ): integer;
Result := a + b;
But this results in "parse error before `:'".
I would think the above operator code should work given the Result
extension. Would it make sense to allow this? Perhaps giving an
error if the Result extension is disabled?
More information about the Gpc