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

Marco van de Voort marcov at stack.nl
Wed Jul 6 08:24:50 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)

-1 is not a valid cardinal -> out of range -> rangecheck error.




More information about the fpc-devel mailing list