Split Temporary Variable

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:

  1. The method is too long.
  2. You need two variables; one for each usage.


See: the "paint_required" example at the bottom of ConstCorrectness.


EditText of this page (last edited December 24, 2003) or FindPage with title or text search