That's a funny interaction between Variants and Pascal's ambiguous
(logical or bitwise) "and" :) Both the operators and the types are
ambiguous -> making the boolean short-circuit evaluation not possible.
Indeed one workaround is to cast the variants to Booleans explicitly,
which makes it use logi
Am 24.05.22 um 19:28 schrieb Thomas Kurz via fpc-pascal:
Dear all,
please consider the following code:
program Project1;
{$booleval off}
var
v1, v2: variant;
a: boolean;
b: integer;
begin
a := true;
b := 0;
// this works as expected:
if a and (b > 0) and ((0+1) mod b =
Dear all,
please consider the following code:
program Project1;
{$booleval off}
var
v1, v2: variant;
a: boolean;
b: integer;
begin
a := true;
b := 0;
// this works as expected:
if a and (b > 0) and ((0+1) mod b = 0) then Writeln ('ok');
v1 := true;
v2 := 0;
// this gives