[fpc-devel] Proposal: Enhanced replacement for assignment operators
Alexander Klenin
klenin at gmail.com
Fri Aug 6 15:53:06 CEST 2010
On Fri, Aug 6, 2010 at 21:31, Marco van de Voort <marcov at stack.nl> wrote:
> In our previous episode, Alexander Klenin said:
>>>> As for multiplication, floating-point and overloaded cases,
>>>> they are simply required since Inc and Dec do not work at all.
>>> inc and dec work fine as far as I know for over a decade.
>>Hm, just re-checked -- no, they do not.
>>They never did and probably never will
> They work perfectly fine.
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.
---
>> (at least, I do not think there is a need to extend them, since a better
>> alternative, assignment operators, is already implemented).
>
> I don't see the need for them. I can see the logical ones being implemented
> for ease of conversion in e.g. compression code, but I never use them.
Logical ones are actually less important for me,
but mod= and especially div= are rather useful.
Last time I wished a had div= was just a week ago.
--
Alexander S. Klenin
More information about the fpc-devel
mailing list