Is there a tool or IDE that will globally rename C variables?

riceman0
riceman0 used Ask the Experts™
on

Hello, is there a tool out there (either standalone or part of an IDE) that can rename all instances of a variable in my C project?  Google searches seem to indicate the eclipse or netbeans are working on this but doesn't look mature (or even complete).

If not, how is it possible that there is no such tool?   .NET for example has been doing this for 10 years, and it is a much faster/safer way to program.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2009

Commented:
Refactoring that is builtin to Visual Studio, Eclipse and other IDEs has renaming.

Also if you use Visual Studio, VA Assist works fine. I use it in C++ projects. (It is by whole tomato software)

I would just try it out before relying on Googled opinions, as some of them are based on older versions.
Top Expert 2009

Commented:
VA Assist is here http://www.wholetomato.com/
GlobaLevelProgrammer

Commented:
I dont know how many pages you have...paste into notpad/textpad..search/replace..
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Top Expert 2009

Commented:
search / replace would be dangerous for a non-trivial project with lots of lines. A good refactoring tool is the mature approach as it actually parses the code to correctly identify one instance of "i" vs another "i".

Author

Commented:

Yeah one needs the tool.  Search replace does not work, you will likely catch symbols that match your pattern that you did not intend to change.  

I guess I'm frustrated because I do embedded programming and neither of the IDEs I have used (CodeVision and IAR) are way behind the times on things like this -- and these are reputable embedded tools I think state of the art.  Visual Studio doesn't really help me because I can't target embedded (we don't use CE).  So visual assist doesn't help, but looks good.

I also thought I read that eclipse doesn't really do this, will look again.
Top Expert 2009

Commented:
Well, its been a while since I tried Eclipse C++ (I don't use it much, as most of my work is either CE/Mobile or desktop). So its entirely possible that the refactoring support for C/C++ is immature there, but I doubt it is non-existent. Eclipse sort of blazed the trail in refactoring as a common tool (with Java).

Is it just me, or does CodeVision appear to be based on Eclipse framework itself?

May be possible to get a bounty started for a plugin for it, but since embedded programming audience isn't as large, you may have to look at using a decent text editor with regex support like Ultraedit or Textpad.

If you are looking for specific expertise with your environments you may want to delete this question and re-open a fresh one with CodeVision, etc. in the title.
Top Expert 2009
Commented:
I found this standalone refactoring tool: http://www.spinellis.gr/cscout/

Have you googled "standalone refactoring c" or something like that?

Author

Commented:

Probably didn't use the word "refactoring" -- yeah that looks really good!

Author

Commented:

Actually it reads really good, but it is very much command-line, not easy to use.  Maybe I'll get the hang of it, but embedded still loses.  
I knew that Netbeans had good refactoring capabilities for Java 10 years ago. I just built a simple C project, and put ptr in two different structs. In one of the struct, I highlighted ptr, right-clicked and selected Refactor -> Rename. I then wrote ptrParam. The ptr in the other struct was left alone. The ptr associated with the changed struct was renamed globally to ptrParam.
BTW - I was doing this using NetBeans IDE 6.9.1

If you have a makefile, then you may be able to build your project automatically. (I haven't done that yet, but the facility is there.)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial