[fpc-pascal] Range check error while evaluating constants

ik idokan at gmail.com
Tue Oct 30 21:44:51 CET 2012


On Tue, Oct 30, 2012 at 10:10 PM, Mark Morgan Lloyd
<markMLl.fpc-pascal at telemetry.co.uk> wrote:
> ik wrote:
>>
>> Hello,
>>
>> I have the following function:
>>
>> function OneToTwoComplement(AValue: QWord): QWord;
>> begin
>>   Result := (AValue xor $FFFFFFFFFFFFFFFF) + 1;
>> end;
>>
>> What am I missing here that makes the compiler complain about "Range
>> check error while evaluating constants" ?
>> Why doesn't it complain on :
>>
>> function OneToTwoComplement(AValue: Int64): Int64;
>> begin
>>   Result := (Abs(AValue) xor $FFFFFFFFFFFFFFFF) + 1;
>> end;
>
>
> What happens in the first case if you cast that constant to a QWord?

The compiler stop reporting warnings

>
> --
> Mark Morgan Lloyd
> markMLl .AT. telemetry.co .DOT. uk
>
> [Opinions above are the author's, not those of his employers or colleagues]
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list