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

inc(longint(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

  v:=v+-5;

_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to