Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

The MERGE Headache

$
0
0

This function gives me a headache because of its non-lazy evaluation of arguments.  For example, MERGE (A(i), 0, i .GE. 1) aborts when array A's lower bound is 1 and i < 1.  Similarly, MERGE (B, 0, PRESENT(B)) aborts when B is an omitted parameter.  This behavior forces one to write ugly IF/ELSE/ENDIF constructs that make code more difficult to read and comprehend.  I suggest  adding to the language a lazy-evaluation function like IIF, which would enable one to write the above examples as IIF (I .GE. 1, A(I), 0) and IIF (PRESENT(B), B, 0) without fear of aborting.

By the word "ugly", I meant to convey the idea that the forced construct occupies more real estate than its importance justifies.

"Lazy evaluation" is also called "short-circuit evaluation".


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>