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

Peter Vreman peter at freepascal.org
Fri Jul 8 18:20:36 CEST 2005


> Marcel Martin wrote:
>
>> I think Marco is right. Basically, when the compiler has to
>> code Inc(x,SomeConstant), the only sensible behaviour it is
>> expected to have is to regard the constant as being of the
>> type of x. So, if x is a Longword and if SomeConstant equals
>> -1, either it adds $ffffffff (and there will be an overflow
>> if x > 0) or it stops at compile time saying that -1 is not
>> a Longword.
>
> IMO the compiler can convert between Inc and Dec, for negative
> constants, so that the value always is positive, compatible with
> signed and unsigned data types.

That means different behaviour between the use of a variable or constant.
That is something you never want.








More information about the fpc-devel mailing list