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

Vinzent Hoefler JeLlyFish.software at gmx.net
Fri Jul 8 13:24:12 CEST 2005


On Friday 08 July 2005 10:49, Gerhard Scholz wrote:

> Beside, v is word or byte, depending on a compiler-$if elsewhere, so
> I would have to write:
>
> inc ( {$ifdef big} smallint {$else} shortint {$endif }v, delta ) ;
>
> Not very clear readable.

Agreed. It's not readable at all. So don't do that, instead

{$IFDEF BIG}
type My_Type = SmallInt;
{$ELSE}
type My_Type = ShortInt;
{$ENDIF}

and then

|Inc (My_Type(v), Delta);

should do the trick.

OTOH, to be honest: I don't see the point in using Inc/Dec here at all, 
especially if "v := v + Delta;" would work perfect already. I even 
think the "standard" way of doing the addition would be much more 
readable in that context.


Vinzent.

-- 
public key: http://www.t-domaingrabbing.ch/publickey.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050708/58aea624/attachment.sig>


More information about the fpc-devel mailing list