Question

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

Was it helpful?

Solution

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

OTHER TIPS

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.

Some C++ refactorings which are supported by for example by Ref++ do not need to fully understand C++ syntax. For example pull up method, push down method etc are quite straightforward. For some reason this kind of refactorings are not implemented to CDT refactorings.

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top