> Well, if A*B+A*C is better than A*(B+C) for a real reason the user had better
> write it that way. Leaving it up to the whim of the compiler as to which
> form is to be used is not an advantage of this proposal.
Right; if a specific form is better, then one should write it
explicitly, in particular use parentheses to force subexpressions to be
evaluated first. However, as Pierre points out, probably in the
majority of cases parentheses are just used because it is clearer and
easier to write A*(B+C) than A*B + A*C. However, the former FORCES the
compiler to evaluate (B+C) first. My point is that now it is not up to
the whim of the compiler as parentheses have the highest priority, which
is nice when one needs it, but this is probably a rarity. These days,
most compilers are better at optimisation than the average programmer.
Thus, it seems better to write obvious code and let the compiler make
the most of it. The problem at the moment is that the obvious way to
write things, with parentheses, forces the compiler to evaluate those
expressions first, even if optimisation etc would prefer something else.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|