Elektrine lite

← Feed

@saagar@federated.saagarjha.com

Post #2598507

2023-03-19 09:48 UTC

@slomo@toot.cat If we can change evaluation order, a smart compiler may decide to inline and reorder so the code to look like this: if (!/* something */ || !/* another thing */) { exit(0); } else { foo(/* something */) + foo(/* another thing */) }

Replies (1)

  • @slomo@toot.cat Notably, it can check early if either value is zero and avoid the expensive computation. With LTR evaluation, if /* something */ was not zero, you’d still have to call do_expensive_thing before you could exit.

    Open ##2598508