Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Visual C++ lacking refactor functionality?

When programming in C++ in Visual Studio 2008, why is there no functionality like that seen in the refactor menu when using C#?

I use Rename constantly and you really miss it when it's not there. I'm sure you can get plugins that offer this, but why isn't it integrated in to the IDE when using C++? Is this due to some gotcha in the way that C++ must be parsed?

like image 974
xyz Avatar asked Dec 12 '08 16:12

xyz


People also ask

Is visual studio used for refactoring the code?

Visual Studio Code supports refactoring operations (refactorings) such as Extract Method and Extract Variable to improve your code base from within your editor.

Is Visual Studio good for C?

Yes, you very well can learn C using Visual Studio. Visual Studio comes with its own C compiler, which is actually the C++ compiler. Just use the . c file extension to save your source code.

What is the function of refactoring feature of Visual Studio 2012?

This refactoring option allows you to remove additional parameters from a method and update the references everywhere that has been used. Generally, you need this feature to remove unused parameters from the methods.

How do you Refactor Variables in Visual Studio?

Press Ctrl+R, then Ctrl+R. (Note that your keyboard shortcut may be different based on which profile you've selected.)


2 Answers

The syntax and semantics of C++ make it incredibly difficult to correctly implement refactoring functionality. It's possible to implement something relatively simple to cover 90% of the cases, but in the remaining 10% of cases that simple solution will horribly break your code by changing things you never wanted to change.

Read http://yosefk.com/c++fqa/defective.html#defect-8 for a brief discussion of the difficulties that any refactoring code in C++ has to deal with.

Microsoft has evidently decided to punt on this particular feature for C++, leaving it up to third-party developers to do what they can.

like image 72
JSBձոգչ Avatar answered Oct 23 '22 17:10

JSBձոգչ


I'm not sure why it is like this, but third-party tools exist that help. For example, right now I'm evaluating Visual Assist X (by Whole Tomato). We're also using Visual Studio 2005.

like image 40
Brian Avatar answered Oct 23 '22 17:10

Brian