User forums > Using Code::Blocks

Feature : dynamically rename a variable

<< < (2/2)

dje:

--- Quote from: rcoll on September 14, 2008, 06:47:58 am ---What am I not understanding?

--- End quote ---
Refactor->Rename means that variable scoping is taken into account, it is the most complicated thing.

Suppose you have i defined for two loops in two different functions.
Right clicking on i in a function and make Refactor->Rename on it could replace i by index for example only in the appropriate method/function, whereas the replace in files would replace any i whole word instances in all files.

Dje

rcoll:

--- Quote from: dje on September 14, 2008, 11:04:50 am ---
--- Quote from: rcoll on September 14, 2008, 06:47:58 am ---What am I not understanding?

--- End quote ---
Refactor->Rename means that variable scoping is taken into account, it is the most complicated thing.

Suppose you have i defined for two loops in two different functions.
Right clicking on i in a function and make Refactor->Rename on it could replace i by index for example only in the appropriate method/function, whereas the replace in files would replace any i whole word instances in all files.

Dje

--- End quote ---

Ah ... got it.  Thanks for the (very good) explanation.  I can now see where this Refactor-Rename might be usefull; although, for my uses, I would still use rename-in-files and just change "Myclass->MyVar" to "MyClass->SomeOtherVar" (but then most of my software is pretty simple and not that compilcated).

Ringo

Navigation

[0] Message Index

[*] Previous page

Go to full version