views:

1797

answers:

4

Is it at the state where it is actually useful and can do more than rename classes?

+13  A: 

CDT (C/C++ Development Tools - eclipse project) 5.0 has a bunch of new refactorings

* Declare Method
* Extract Baseclass
* Extract Constant
* Extract Method
* Extract Subclass
* Hide Method
* Implement Method
* Move Field / Method
* Replace Number
* Separate Class
* Generate Getters and Setters

There is a CDT refactoring wiki

Benoit
+1  A: 

Yeah and most of them don't work actually if the code is too complicated. Things like move a method, rename, etc have problems sometimes.

don't use macros and #if and all is going to be fine.
Mykola Golubyev
+1  A: 

C++ is a very hard language to provide refactoring support for. This is because the langauge is very complex and hard to parse but its mostly because of the preprocessor.

The preprocessor is the main reason why C/C++ IDEs lag behind other languages.

Mike Kucera
That, and the fact that C++ does not have a stateless grammar.
Matt Cruikshank
+2  A: 

There have been numerous efforts to provide refactoring tools for C++, most of them failed pretty early, because the creation of such tools requires the full ability to process C++ source code, i.e. you need a working and full c++ compiler in the first place to implement even the most basic forms of automated source to source transformations.

Fortunately, with the introduction of plugins into gcc, it it's finally becoming foreseeable that related efforts may actually be able to leverage an existing C++ compiler for this purpose, instead of having to resort to their own implementations of a C++ compiler.

For a more in depth discussion, you may want to check out this.

For the time being, the most promising candidate to provide widely automated C++ refactoring support, is certainly the Mozilla pork project, along with its related companion project Dehydra.

none