Feature #1678
rollup/simplify/remove dead code usually caused by preprocessor substitutions
0%
History
#1 Updated by Eric Faulhaber over 13 years ago
Often 4GL preprocessing directives/substitutions will expand to bloated code which converts to something more complicated than it needs to be. For example, we have seen expanded (preprocessed) code similar to this:
for each item where item.site = current-site and item.vendor = (if "" <> "" then "" else item.vendor)
Since the embedded ternary expression (if "" <> "" then "" else item.vendor) will always evaluate to false, the second portion of the where clause effectively is ...and item.vendor = item.vendor, which is the equivalent of ...and true. As such, that part of the where clause could be dropped, so that what we really are converting is
for each itemloc where itemloc.item = cur-item
However, any expression rewriting in a where clause must ensure that the index selection that would normally be driven by a more complex where clause is not broken (i.e., this rewriting must occur after index selection on the original where clause).
#2 Updated by Greg Shah over 13 years ago
- Target version set to Code Improvements
#3 Updated by Greg Shah over 9 years ago
- Target version changed from Code Improvements to Converted Code Improvements - Deduplication