[fpc-pascal] New feature: IfThen() intrinsic

Sven Barth pascaldragon at googlemail.com
Sun Jan 31 16:17:13 CET 2016


On 31.01.2016 16:14, Vojtěch Čihák wrote:
> what is difference in produced assembler between ifthen(); and classic
> if - then - else?

=== code begin ===

i := IfThen(x < 42, 32, 49);

=== code end ===

is equivalent to

=== code begin ===

if x < 42 then
  i := 32
else
  i := 49;

=== code end ===

That's in fact how the compiler handles this internally (with the added
benefit of nesting IfThen()s).

Regards,
Sven



More information about the fpc-pascal mailing list