[fpc-devel] bug: Inc(v,i)/Dec(v,i)
Micha Nelissen
micha at neli.hopto.org
Tue Jul 5 09:25:48 CEST 2005
On Tue, 5 Jul 2005 09:19:42 +0200 (CEST)
"Peter Vreman" <peter at freepascal.org> wrote:
> The following code also fails with an overflow
>
> {$Q+}
> var
> v : cardinal;
> begin
> v:=100;
> inc(v,-1);
> end.
>
> The reason is that -1 is in fact an addition of $ffffffff resulting in the
> carry flag being set and therefor an overflow.
If adding a negative number to an unsigned one, the overflow flag needs to be inverted ?
Micha
More information about the fpc-devel
mailing list