SplitTemporaryVariable
Last edit December 24, 2003
SplitTemporaryVariable
"You have a temporary variable assigned to more than once, but it is not a loop variable or a collecting temporary variable. -> Make a separate temporary variable for each assignment."
From page 128 of
RefactoringImprovingTheDesignOfExistingCode
book:
http://www.refactoring.com/catalog/splitTemporaryVariable.html
Typical symptom: A single variable has different meanings in different parts of a method.
Conclusion:
The method is too long.
You need two variables; one for each usage.
See: the "paint_required" example at the bottom of
ConstCorrectness
.