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

Vinzent Hoefler JeLlyFish.software at gmx.net
Thu Jul 7 09:47:03 CEST 2005


On Thursday 07 July 2005 05:39, Peter Vreman wrote:

> > shouldn't it implement inv(v,-1) in exactly the same way it
> > implements v:=v-1?
>
> The problem is what type do you give to -1. In the old situation the
> -1 was converted to the same type as v -> longword.

Which should trigger a range check already, because -1 can't be 
represented as valid longword.

Personal note: Maybe there was a reason why Borland Pascal didn't do 
range checks on Inc/Dec. The only time I ever used it was a checksum 
calculation which was modulo anyway. Any other time I use the usual 
operators. So especially with the "added" overflow check I think, Inc 
and Dec are pretty useless functions, because the don't do anything you 
can't accomplish by using "+" or "-" unless you have 
very_long_and_complex_variable_names and want to save some typing work.


Vinzent.

-- 
public key: http://www.t-domaingrabbing.ch/publickey.asc





More information about the fpc-devel mailing list