Next | Program Repair Shop | 197 |
A related issue is
if ($x != 2) { $x = 2; }
This can be replaced by
$x = 2;
This is usually written by beginning programmers
They want to save time by skipping the assignment if it is unnecessary
Unfortunately, the test takes just as long as the assignment would have
This sort of micro-optimization is best avoided anyway
Next | Copyright © 2002 M. J. Dominus |