by JoeAltmaier · 11y ago · 0 comments
x = <LHS> + 1;
It could then get arbitrarily complex. E.g. x = (<LHS> + 1) / atan(<LHS>) - <LHS>;
and no matter how complex 'x' was in practice, the compiler (and the code reader) could keep track of what was happening. y = (x + 1) / atan(x) - x;
x = y; // If you're in a loop and updating some value
If would hope/imagine that a compiler could reduce the two to the same code - and I don't think it reads any worse. Is there a downside beyond the extra line of code? X &x = { complex reference expression for x }
y = (x + 1) / atan(x) - x;
Now the compiler has the clues it needs to write good code.
And with language support I don't have to introduce new names for each occurrence; just one name like <LHS> that readers can quickly learn.Having <LHS> as a name is only useful I think if you don't want to give it another name? I was asking what's the downside of giving it a name.