简体   繁体   English

Eclipse中C ++重构支持的状态是什么?

[英]What is the state of C++ refactor support in Eclipse?

它是否处于实际有用的状态,并且可以做的不仅仅是重命名类?

CDT (C/C++ Development Tools - eclipse project) 5.0 has a bunch of new refactorings CDT(C / C ++开发工具 - eclipse项目)5.0有一堆新的重构

* 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 有一个CDT重构维基

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, ie 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. 为C ++提供重构工具已经做了很多努力,其中大多数都很早就失败了,因为这些工具的创建需要完全处理C ++源代码的能力,即你需要一个工作的完整的c ++编译器来实现甚至是最基本的自动源到源转换形式。

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. 幸运的是,随着插件插入gcc ,它最终变得可以预见,相关的努力实际上可能能够利用现有的C ++编译器来实现这一目的,而不必诉诸于他们自己的C ++编译器实现。

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 . 目前,最有希望提供广泛自动化C ++重构支持的候选者当然是Mozilla 猪肉项目,以及相关的伴侣项目Dehydra

Some C++ refactorings which are supported by for example by Ref++ do not need to fully understand C++ syntax. 例如由Ref ++支持的一些C ++重构不需要完全理解C ++语法。 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. 出于某种原因,这种重构没有实施到CDT重构中。

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. C ++是一种非常难以提供重构支持的语言。 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. 预处理器是C / C ++ IDE落后于其他语言的主要原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM