RunError(215) occurs only in win 64 bit, not win 32 bit
When I compiled the following simply programs using Lazarus 1.8 fpc
3.0.4 Win 64, run it, it will throws RunError(215) Arithmetic overflow
However, if I compile and run the same in Lazarus 1.8 fpc 3.0.4 win 32,
it won't raise the RunError (215).
LW1, LW2 : array[false..true] of LongWord;
c : currency;
aBoolean : Boolean;
LW1[false] := 5;
LW1[true] := 5;
LW2[false] := 10;
LW2[true] := 10;
c := 10;
aBoolean := (LW1[true] + LW1[false]) - (LW2[false]+LW2[true]) > c ;
Writeln('if compiled in 64 bit, a RunError(215) will have occurred
and it will not reach this line');
Re: RunError(215) occurs only in win 64 bit, not win 32 bit
> On Wed, Jan 24, 2018 at 12:59 PM, Marco van de Voort <[hidden email]> wrote:
>> Which seems correct. The expression to compare with is entirely longword and
>> it gets negative (5+5) - (10+10).
> But shouldn't it then also give the same error if compiled for 32 bit?
The weird thing is, in 32 bit, the compiler gives the Hint: (4079)
Converting the operands to "Int64" before doing the add could prevent
but does not raise the RunError(215).
The 64 bit compiler does not give the Hint but raises the RunError(215).