[fpc-devel] bug: Inc(v,i)/Dec(v,i)

Marco van de Voort marcov at stack.nl
Fri Jul 8 11:52:02 CEST 2005

> Solution 1 of course would be:
>     if delta < 0
>         then dec ( v, -delta )
>         else inc ( v, delta ) ;

> but that looks like a joke and not very optimal.
> Solution 2 would be the safe way (as I'm forced to do it now):
>     v := v + delta ;
> I think the easiest solution to the whole problem would be to internally
> translate a "inc(v,d)" to "v := v + d", at least in {$r+,q+} checked code.

This doesn't fix the problem that you are mixing types. v:=v+d is flawed from
that perspective too, the compiler even complains

smbg.pp(9,7) Warning: Mixing signed expressions and longwords gives a 64bit result

on a line like


More information about the fpc-devel mailing list