[fpc-devel] Re: Proposal: Enhanced replacement for assignment operators

Honza befelemepeseveze at gmail.com
Fri Aug 6 16:49:25 CEST 2010


On Fri, Aug 6, 2010 at 21:31, Alexander Klenin wrote:

> Sorry, but I do not believe you have ever tried.
> Here are samples, please try compiling them before asserting that they
> work fine:
> ---
> var a: Double;
> begin
>  Inc(a, 2.0);
> end.
> ---
> {$mode objfpc}
> type TPoint=record x, y: Integer; end;
> operator+(const a, b: TPoint): TPoint; begin { ... } end;
> var a, b: TPoint;
> begin
>  Inc(a, b);
> end.
> ---

http://www.freepascal.org/docs-html/ref/refsu5.html#x27-260003.1.1

Inc and friends (Succ, ...) are defined on ordinal types only and
actually they work just fine. The above examples are outside of that
definition domain. Additionally, semantics of Inc is defined using the
add operation, not using the add/plus operator, iirc.

-bflm



More information about the fpc-devel mailing list