3 ms·
Is the ternary conditional just for the syntactic ease or there are some performance reasons for this? I understand there are conditional assignment instructio
by zoomablemind 5y ago
Is the ternary conditional just for the syntactic ease or there are some performance reasons for this?
I understand there are conditional assignment instructions, though optimizer could likely choose these already. Also branching prediction may take care of such assignments as well.
- pklausler 5y agoFortran has no means for preventing execution of subexpressions in a portable way. The standard allows a compiler to short-circuit .AND./.OR. and to evaluate only one of the first two arguments to a MERGE with a scalar condition, but it is not required and a programmer can’t depend on it. Rather than strengthen the guarantees of short-circuiting and non-evaluation of existing constructs (neither of which would have invalidated any portable code), the geniuses of J3 decided to add more syntax.