Hello Everyone,
My name is Sunny Gupta and I am a SDET on VC++ IDE & Compiler team. In this blog I will be talking about the IDE support for Cpp0x.
What is C++0x??
C++0x is the name for the next version of the C++ Programming Language Standard. For VC 10, the C++ 0x features that have been implemented in the compiler so far are “auto”, “lambdas”, “rvalue references”, “decltype”, “nullptr” and “static_assert”.
Details about these can be read from:
· Lambda-auto-static_assert
· Rvalue-reference
· Decltype
It will be super cool if the IDE could provide Intellisense and Browsing for all these new features, is VS team going to do that?
– Yes, Beta2 is going to have all the intellisense and browsing functionality for these c++ language changes.
Brief Overview of what to expect.
Before I explain the details of feature I would like to list the cool things.
· A static_assert getting squiggled (red wavy underline under the word indicating some error) with the assert message as the error message.
· Getting parameter help(tool tip about the parameter of the lambda) on lambdas
· Quick info(tool tip that pops up on mouse hove) showing the actual type of an object that is declared using auto
· Complete intellisense for rvalue references as lvalue reference.
· Quick info, Auto Complete etc ., working inside the decltype statement.
Outline of the Feature
The feature can be better explained with the help of some screenshots: I will be demonstrating just few of the many intellisense/browsing options available.
Design and Development of the feature
We had one main goal while designing this feature. That goal was intellinsense parity for cpp0x with all the other cpp constructs. We had the following things in mind during designing the feature:
· Writing and using lambda should be as easy as writing and using a regular C++ function.
· Intellisense on an object declared using ‘auto’ or ‘decltype’ should be the same if the object was declared using the actual type name
· Writing a static assert should be as easy as making a function call to some inbuilt function.
· Intellisense for rvalue reference should behave the same was as it used to behave for an lvalue reference
Development involved integration of the new cpp0x features with the current intellisense engine. The challenging part was ensuring the IDE shows the expected intellisense and browses to the correct location. Example: Ensuring that on the IDE a lambda is represented as a function with return type and arguments. Lambdas are actually classes with overloaded operator (). So a lambda statement internally creates a class with overloaded operator (). During development just integrating the cpp0x with the intellisense engine would results into lambda being represented as ‘operator ()’ in the tooltips. Instead of lambda name. We had to makes sure where ever the lambda will be shows, class view, Quick info, Call Hierarchy etc., it should not be displayed as ‘operator()’ and a proper readable signature should be shown.
Testing
I was the QA for the feature. Since this was not an isolated feature, the challenging part was to ensure complete intellinsense and browsing functionality inside the IDE for these new c++ language features. Dedicated testing was needed for browsing (Quick Symbol Search, Class View, Navbar, Gotodef etc.) and intellisense (Quick Info, Auto Complete, parameter help and squiggles). This feature is an IDE feature so equal importance was given to IDE testing along with the engine level testing.
Example of an IDE tests is: Ensuring that on mouse hover over a static assert squiggle shows the correct error message tool tip.
Example of an Engine level test: ensuring that the Intellisense compiler API returns correct intellisense results. These API are called from the editor to display the results.
More information on testing can be gained from the blog : Testing VC++ Compiler and Intellisense
Customer Impact & Summary
Having this will enable customer to easily and accurately use cpp0x. Since cpp0x inevitable creates a thin level of wrapping on the underlying Cpp implementation, having intellisense and browsing will ensure better readability of the code. It would be a pity if such great C++ features are not used because the IDE is not intelligent enough to help the programmer navigate their complexity. With the changes we have made to the IDE and IntelliSense engine, we certainly hope we have taken care of that problem. We are excited about these new features and we hope you will like them too.
0 comments