[fpc-devel] bug: Inc(v,i)/Dec(v,i)
Gerhard Scholz
gs at g--s.de
Tue Jul 5 22:26:52 CEST 2005
...
> > 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.
>
> For cardinal IMHO not-a-bug?
I think it's a bug for cardinals and other unsigned ints also (as long as the
result is in the range of the result variable)
More information about the fpc-devel
mailing list