Hello I discovery in Delphi3Old the function if_variant
The function "if_variant" contatin too many bugs in Delphi3.
--a) how to compare s1,s2 with nil value OR how to protect if_variant with Nil crash
Function if_variant(condtion:wordbool;s1,s2:variant):variant;
Begin
if (condtion) then if_variant:=s1 else if_variant:=s2;
End;
--b) If_variant inside While, if_variant is too slow. Can I extend if_variant with _inline or _assembler? How do ? Is really more fast of speed with if_variant+inline.
while (if_variant(extmax<>nil,(extmin<extmax)and(extmin^<>atonexit_c),extmin^<>atonexit_c)) do
Begin
fox:=0;
c1:=extmin^;
inc(extmin);
if (c1=#0) then exit;
if (c3=atonexit_c) then exit;
while (not (c1 in ['A'..'z'])) do
Begin c1:=extmin^;
inc(extmin);
if (c1=#0) then exit;
if (c3=atonexit_c) then exit;
End;
--c) Which if_variant is more good?
Function if_variant1(condtion:boolean;s1,s2:variant):variant;
Begin
if (condtion) then if_variant:=s1 else if_variant:=s2;
End;
Function if_variant2(condtion:wordbool;s1,s2:variant):variant;
Begin
if (condtion) then if_variant:=s1 else if_variant:=s2;
End;