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

Florian Klämpfl florian at freepascal.org
Sat Aug 7 12:31:06 CEST 2010


Am 07.08.2010 12:04, schrieb Martin:
>  On 07/08/2010 08:28, Florian Klämpfl wrote:
>>
>> Nevertheless inc/dec generates better code because fpc is too dump to
>> convert += / -= into inc/dec etc. :)
> Better in which way?
> 
> I did a quick test (on a very simple source only) (fpc 2.5.1)
> 
> inc(a), a+=1; a:= a + 1; all generate "incl"
> 
> inc(a,3); a := a + 3; generate "addl"

Yes, but only in simple situations.

Just compare the code in:

var
  i : longint;
begin
  while i>1 do
    i+=1;
  while i>1 do
    inc(i);
end.



More information about the fpc-devel mailing list