Link to home
Start Free TrialLog in
Avatar of riceman0
riceman0

asked on

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


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.
Avatar of mrjoltcola
mrjoltcola
Flag of United States of America image

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.
I dont know how many pages you have...paste into notpad/textpad..search/replace..
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".
Avatar of riceman0
riceman0

ASKER


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.
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.
ASKER CERTIFIED SOLUTION
Avatar of mrjoltcola
mrjoltcola
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

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

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.  
Avatar of phoffric
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.)