Safest way to change variable names in a project
Posted
by
kamziro
on Stack Overflow
See other posts from Stack Overflow
or by kamziro
Published on 2011-01-12T05:15:56Z
Indexed on
2011/01/12
5:54 UTC
Read the original article
Hit count: 304
So I've been working on a relatively large project by myself, and I've come to realise that some of the variable names earlier on were.. less than ideal.
But how does one change variable names in a project easily? Is there such a tool that can go through a project directory, parse all the files, and then replace the variable names to the desired one? It has to be smart enough to understand the language I imagine.
I was thinking of using regexp (sed/awk on linux?) tools to just replace the variable name, but there were many times where my particular variable is also included as a part of strings.
There's also the issue about changing stuff on a c++ namespace, because there is actually two classes in my project that share the same name, but are in different namespaces.
I remember visual stuio being able to do this, but what's the safest and most elegant way to do this on linux?
© Stack Overflow or respective owner