C++: Is there a way to avoid redundancy with changing long declarations?
This has always bugged me with C and C++:
In my header file I have something like:
bool UpdateWindow( int w, int h, char bpp, bool force, char* someOtherLongStuff )
Now, if I want to change that for whatever 开发者_运维技巧reason, I have to do so in both header and source file - that's annoying in my opinion.
Is there a way to automate this?
I'm using Visual Studio 2010
I think I got it running with Visual Assist from Wholetomato. It's commercial but you could give it a try...
C++ was a long time ago - at least for me :)
I don't know of a shortcut for this, but even if one exists it might not give you as much of a saving as you imagine. If you are changing the header file then there are probably a lot of other places that will be affected by the change (the method body, other application code that includes this header, your client's code if you ship it as a library, unit tests, etc.) so having to change it in two places is just the tip of the iceberg.
Not with the standard visual studio. I think you need a refactoring tool like Resharper, but I am not sure it will work for C++. Refactoring for C++ is a very though problem. My best shot would be to just follow the declaration with ctrl+click on the name and change in both sides.
精彩评论