VC++ Bytes 2-1: Create Declaration/Definition with Oleg Kharitonov

Play VC++ Bytes 2-1: Create Declaration/Definition with Oleg Kharitonov
Sign in to queue


Welcome to Season 2 of VC++ Bytes! This season is dedicated to showcasing [potential] new C++ features in the next release of Visual Studio (currently dubbed Visual Studio "14").

The "season premiere" kicks off again with Visual C++ IDE developer Oleg Kharitonov, whom I worked with to create today's featured feature: Create Declaration/Definition. (Yes, I do more at Microsoft than just make videos =P)

Create Declaration/Definition enables a user to quickly create a function's counterpart, and positions it near its neighbors. Watch this video for a demonstration as well as some tips and tricks you can do with the feature!

Want to try this feature out (amongst others)? Click here to download (for free!) the Visual Studio "14" CTP 1, and give us feedback about the feature in the comments!

Stay tuned for more features from this pre-release and future pre-releases as well!

(Note: Those of you with sharp eyes probably noticed the duplicate Refactor menu item; we did the demo in Oleg's personal branch in a later build where he's experimenting with other refactoring options. You should only see one in the actual CTP.)



Download this episode

The Discussion

  • User profile image

    i'd like to see 'move implementation to cpp files' feature like VAssistX, also, batch refactoring for all functions in a class.

  • User profile image

    Nice work, that will be handy! I've wondered why that wasn't implemented before, it seems like such an obvious feature for an IDE to have. I like the code-peek so you can see exactly what's happening.

    Speaking of obvious features that are missing... can you please add the ability to let me press a key to switch between the .h and .cpp file (you could restrict it to when the files have the same name to make it easy)?

    Ctrl+Tab does not suffice here because it switches between all open files. I want to be able to quickly switch to the definition/declaration file with a single key press.

  • User profile image

    @Gordon: re: "can you please add the ability to let me press a key to switch between the .h and .cpp file"

    The feature exists in VS2013 (Toggle Header/Code File); the shortcut for it is Ctrl + K, Ctrl + O 

  • User profile image

    @gha11: Thanks!

  • User profile image

    Very nice features, though I believe you can do the same by writing IDE macros.

  • User profile image

    @gha1 @Gordon One caveat about Ctrl+K,Ctrl+O is that it only works if the .cpp and .h files are in the same directory. That's not the case in our codebase so that feature doesn't really work for us.

    The create decl/def refactoring is very handy and I'm looking forward to trying it out.

  • User profile image

    @felix9: I've been itching to reply to your comment, but couldn't say anything until it was official: We were working on the Move Implementation to Source feature even before CTP 1 was released, and the feature is now available in Visual Studio 14 CTP 2 as of today! (It is called Move Definition Location, because it includes the ability to move from source to header as well if desired.)

    I'll be doing a video on it along with other features in an upcoming VC++ Bytes episode =)

  • User profile image

    @gha11, thanks for the heads-up.

    1. Is there anything like "Remove unused #includes" in C++, like "Remove unused usings" of C#? If its possible, please add

    2. Would you please add the ability to batch format .cpp documents? Given the editor settings, just execute the EvnDTE to format document. Something like this BatchFormat extension for C#. I love its last option "Remove and Sort Usings And format documents". I run this on Solution before the making the release. It helps me keep my code always slim, neat and clean.


    Thanks again for all the wonderful work you guys are doing!

  • User profile image

    Excellent stuff, please keep up the great work. This feature together with the renaming you already implemented covers about 90% of my daily refactoring tasks (currently using Visual Assist).

    Other useful features would be "move to namespace" and creating XML comment templates from a function declaration like in C#.


  • User profile image

    @TheDeeds, @rab36

    Thanks for the suggestions; I have made sure that each of them is on our feature list. While I can't promise that we'll get to them in time for our next official release of VS, I made time to draw our team's attention to them and we all agreed that each of them is certainly useful ;)

Add Your 2 Cents