C++ Annotated: Apr – Aug 2017

Today we are happy to share our next compilation of C++ news with you.

Subscribe to the regular C++ Annotated and be the first to get the next edition!

C++ Annotated: April – August 2017

A long time has passed since the last edition of C++ Annotated. Which means today we have lots of great articles and news to share with you. In this edition:

  • C++ language news
    • C++20
    • Metaclasses
  • Conferences
    • Recent events like ACCU and C++Now
    • Upcoming events
  • Learning
  • Releases

C++ language news


With C++17 ready for final publication by the end of 2017, we can now start thinking about the future of C++ and in particular C++20. The Toronto C++ committee meeting was solely about just this! Just look:

  • Concept TS was merged into C++20 draft. It takes now only one clean syntax (out of three) and doesn’t include function concepts.
  • Coroutines TS, Networking TS and Ranges TS are done, Modules TS is quite close.
  • Several nice enhancements like designated Initializers, template syntax for generic lambdas, default member initializers for bit-fields and others.

It seems that Fall will bring even more exciting features to C++20, and maybe for example, compile-time reflection. (And here’s one to definitely have a check of the talk by Jackie Kay from C++Now). And not to mention the library evolution group and new standard library under discussion. To find out more check Herb Sutter’s traditional trip report. And if you want a summary table view, check the trip report by Botond Ballo.
Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

What’s New in ReSharper C++ 2016.3 and 2017.1

ReSharper Ultimate 2017.1 is out! It’s been some time since our last post about updates in ReSharper’s C++ support, so let’s take a look at what has kept the team busy.
ReSharper C++ 2017.1
Major areas of improvements include:

Visual Studio 2017 support

Visual Studio 2017 has launched, bringing a lot of new features and improvements to C++ developers. ReSharper C++ 2017.1 has full support for the latest Visual Studio release, including:

  • The handling of the v141 toolset, the C++ Language Standard project property and the equivalent /std compiler command line argument.
  • Understanding of several new C++ language features.
  • Support for the Enable Faster Project Load IDE option.

Most importantly, ReSharper C++ introduces initial support for the Open Folder functionality and CMake-based projects in Visual Studio 2017. The latter is particularly helpful since it eliminates the need to regenerate and reload the Visual Studio project when CMakeLists.txt is modified. However, there are a couple of related caveats:

  • In the Open Folder mode without a CppProperties.json configuration file present, ReSharper C++ will use include paths set via the INCLUDE environment variable. You can start Visual Studio from the developer command prompt to have INCLUDE automatically populated with paths to the standard library and Windows SDK.
  • Since there is no Debugging property page, additional configuration is required if you want to use ReSharper’s unit testing capabilities. You can specify how to run tests on the new page, Tools | Unit Testing | C++ Tests, in ReSharper options.

Please note that support for this kind of projects is still experimental — do let us know if you experience any problems!

We’ve also updated ReSharper C++ to handle several new types of projects — properties like predefined macros, include paths, and others should be correctly read from VisualGDB MSBuild, Linux Makefile, and CUDA projects. Moreover, when a compiler other than MSVC is used, ReSharper C++ predefines a number of macros for better compatibility with GCC and CLang compilers.

Language features

C++17 nested namespace definitions are now supported in ReSharper C++. Available since VS 2015 Update 3, this feature provides a concise way of defining nested namespaces. When ReSharper C++ detects that the latest language standard is being used, the Convert to nested namespace definition context action is available to change the old-style syntax into the new one:
Nested namespaces

ReSharper C++ also understands some of the other language features introduced in VS2017, in particular C++17 terse static_assert and C++14 no implicit const specifier on constexpr functions.

Last, std::is_constructible, std::is_convertible, std::is_polymorphic, and std::is_standard_layout C++11 type traits are now supported.

Introduce/Inline typedef

A couple of new refactorings were implemented to complement the existing Substitute typedef context action. The Introduce typedef refactoring allows you to quickly create a typedef for the selected data type and replace this data type and all its occurrences with the newly created typedef. The Inline typedef refactoring does the opposite: it replaces an existing typedef with the actual data type.
Typedef refactorings

Needless to say, these refactorings also support C++11 type aliases. If you want the Introduce typedef refactoring to insert a type alias instead of a typedef declaration, set this behavior on the options page Code Editing | C++ | Code style.

Unit testing

In addition to Google Test and Boost Test, ReSharper C++ 2016.3 delivered first class support for Catch, a cross-platform test framework for C++. Catch is popular because of its ease of use and expressive API, which allows you to divide test cases into sections (each of which is run in isolation) and structure them using BDD style. The framework is distributed as a single header file, with no external dependencies (beyond the C++03 standard library). You can always get the latest version of this header directly at this URL. For an introduction to Catch, please refer to the Catch tutorial, watch the CppCon presentation, or read the article in the CLion blog.

We are also happy to say that the author of Catch, Phil Nash, joined JetBrains as a developer advocate last fall. If you have any ideas on how to improve Catch integration into JetBrains products or have feature suggestions for Catch itself, do not hesitate to contact him!

Other updates in unit testing support include:

  • Boost Test runner has been updated to support Boost 1.62, 1.63 and 1.64. We have also fixed performance issues while working with a large number of dynamic tests and changed the runner to ignore output from the test program, so it does not affect parsing of the XML test report.
  • Google Test runner now supports the 1.8 release of the framework. ReSharper C++ will also correctly merge results of several runs and calculate total execution time if the --gtest_repeat flag is used to run the tests several times.
  • The list of unit tests is now automatically updated after external file changes (for example, when unit tests are generated as a result of a build step).


Postfix templates, a popular feature first introduced by ReSharper for C#, allow you to focus on your data rather than the syntax. ReSharper C++ gets a set of its own templates specifically tailored for C++. You can now quickly wrap an expression with several available templates, including if, else, while, do, return, switch, foreach, and others.
Foreach template

The new options page Code Editing | Postfix Templates lists all the available postfix templates. It allows you to disable the ones you do not use, and contains a number of related options.

Postfix templates

One common C++ coding practice is to prefer non-member non-friend functions to member functions. This is a great way to increase encapsulation and keep class interfaces as minimal as possible (see item 32 in Scott Meyer’s “Effective C++” for a detailed discussion). However, from the tooling perspective there have always been drawbacks to this practice. Whereas member completion list shows all the available member functions, it’s not so easy to list and complete non-member functions which are applicable to an object of the given class. This problem is now solved by ReSharper C++: when you type a dot (.) or an arrow (->) after an expression, free functions that accept that expression as the first parameter will be suggested in the completion list as well as member functions.

Code cleanup and inspections

ReSharper C++ 2017.1 introduces cleanup tasks, including:

  • A set of tasks to apply the existing quick-fixes for common code issues.
  • The Update file header cleanup task, which updates the comment at the top of the file according to the template specified on the options page Code Editing | File Header Text (take a look at the related blog post for more details).

To run code cleanup, use the command ReSharper | Edit | Cleanup Code (Ctrl+E, C) — it will work either with the current text selection, the entire file opened in the text editor, or on a set of files and projects selected in the solution explorer. You have the choice to use the built-in profile (which has several of the tasks that you might not always want to run disabled) or create your own. Here’s one that shows all the available C++ cleanup tasks:
Code cleanup

Control flow inspections (uninitialized/reassigned/unused variable and the like) used to work only with local variables and function parameters, but now class fields are also analyzed. For example, ReSharper C++ will find a self-initialization error in this snippet:
Self initialization
Or an uninitialized member here:
Uninitialized member

If you declare a local variable and initialize it later without any conditions, ReSharper C++ now suggests to join declaration and assignment where the variable is first initialized. This removes the unnecessary statement and improves code readability.
Join declaration and assignment

We have introduced several ReSharper-specific C++11 attributes that can be used to improve the results of certain inspections. For example, ReSharper C++ now understands the [[rscpp::format]] attribute (or, alternatively, [[gnu::format]]), which can be used to enable printf format string analyses for user-defined functions (RSCPP-15890).
printf attribute
There are also attributes to mark functions as having side effects (see RSCPP-18615) and guard classes for which the Unused variable highlighting should be suppressed (RSCPP-18764) — please refer to the corresponding issues for examples of their usage.

A number of smaller new code inspections were also added:

  • Incrementing expression of type bool and Deprecated register storage class specifier for language features removed in C++17.
    Incrementing bool
  • Deleting a void pointer is undefined behavior according to the C++ standard.
    Deleting a void pointer
  • Redundant void argument list (void argument lists are only useful in C code).
    Redundant void argument list
  • Private special member function is not implemented, which reminds you to use the C++11 = delete specifier instead of making the function private and omitting its definition to prohibit its usage.
    Private special member function not implemented

ReSharper’s File Status Indicator (the small icon at the top of the Error Stripe) receives a new context menu. With a right-click on the icon, you can quickly toggle not only ReSharper code analysis, but also identifier highlightings and Visual Studio code analysis (the lightbulb and squiggles). If there are code issues in the current file, you’ll also see commands for navigating between issues of the highest severity level (you can still use the good old Inspect | Next/Previous Error/Warning commands to do that).
File status menu

Finally, a new option on the options page Code Editing | C++ | Inspections controls the visibility of gutter icons (like “Navigate to definition/declaration”), should you find they clutter the user interface too much for your liking.

Documentation support

ReSharper C++ 2016.3 finally learned to display rich syntax-highlighted tooltips for C++ code elements. The contents of the tooltips mirror what was previously available through the Quick Documentation popup, namely function and variable types, containing namespace, template and function parameters, as well as documentation comments.
Quick info

In addition to the standard Doxygen syntax, ReSharper C++ now understands C#-style XML documentation comments.
XML documentation

Finally, while only references to function parameters were resolved before from inside documentation comments, now template parameter references are also supported. This means that they will be shown in the list of results from Find Usages and updated by Rename when it is used on a template parameter.

Command line tools

ReSharper Command Line Tools (CLT) are a standalone set of command line tools that enable you to run code inspections outside of Visual Studio (for example, on your CI server or code quality management system). You can now use inspectcode.x86.exe from the CLT distribution to analyze C++ projects and generate a report with found code issues. What’s the best part? CLT are free and do not require an active license. To analyze your solution, just run inspectcode.x86.exe -o=report.xml YourSolution.sln.

Command line tools

You can either get CLT via a NuGet package or download a standalone archive. In the latter case ensure that the downloaded .zip file is “unblocked” before extracting: right click on the file, select Properties and click Unblock. (Failure to do this will cause the .NET framework to load the application in partial trust, which means it won’t load or run correctly.)

For an in-depth description of CLT usage, refer to the blog post ReSharper Code Analysis Goes Beyond Visual Studio.


In terms of performance, we have recently targeted ReSharper C++’s memory usage to make it work better with huge solutions. (Since we still run in-process, we’re limited by the amount of memory Visual Studio can use as a 32-bit process.) As a result, both the memory footprint after indexing and memory traffic during indexing have improved significantly. In some cases (like the Unreal Engine 4 solution), the amount of managed memory used has decreased by up to 30%. Furthermore, a number of issues have been resolved that had caused excessive memory usage due to background editor and Find Results tabs. All of these changes should help with the debugging experience, since additional memory usage during debugging might have led to memory pressure. If you had problems with debugging before, we would also recommend trying Visual Studio 2017, which improves memory usage during debugging.

In C++ code, when you change preprocessor directives in a header file anything can happen. For example, if you add a #define or #include some file into a header file, the meaning of code can change in any file that uses that header. ReSharper C++ used to reindex all includers after a change like this, which is quite taxing on big projects, especially for common headers which get included into most C++ files. We have revisited this behavior, and now ReSharper C++ does not reindex these files by default, so the symbols in them are still used for navigation and refactoring purposes. This is a compromise between correctness and speed, the old behavior can be restored using an option in the Code Editing | C++ | Performance page. This page also contains a new option to limit the number of concurrent threads used by C++ caches — you can try tuning it to improve responsiveness during the code indexing phase, at the cost of total indexing time.

If ReSharper’s performance is still unsatisfactory, you can use the Third-party code options page to stop ReSharper C++ from indexing specific files and folders.
Third-party code
This page allows you to specify two kinds of filters:

  • Skipped Code contains files that do not get indexed at all, and is usually the right way to exclude third-party dependencies. Only indexing roots (normally .cpp files) are excluded, so if a .cpp file that is indexed includes some header files, their contents will be indexed regardless of third-party settings (since this is a prerequisite for correct parsing). So in practice, you should be able to just add the directories with third-party libraries to “Skipped code”, and if you include a header from a skipped library into your code, ReSharper will still be able to navigate to it.
  • Library Code contains files that ReSharper C++ must not modify. Highlightings are disabled inside these files, but they get indexed and ReSharper C++ is aware of symbols inside them. For example, Goto Symbol and auto-import will work for those files.

The File and folders list can only contain files and folders that are a part of the solution. The File masks list allows to match arbitrary paths. Masks are automatically prefixed by **/ and are matched against absolute file paths. If you want to match all files inside a folder, /** would also be required at the end of the mask. So for example, files inside C:/Foo/Bar would be matched by Bar/**, Foo/Bar/**, or C:/Foo/Bar/** (although shorter masks might match unwanted folders too).

Code formatting

EditorConfig offers a convenient way to share code style settings between teammates who use different editors and IDEs. ReSharper 2017.1 supports EditorConfig configuration files out of the box. To learn more about this, refer to the Using EditorConfig help section or watch the introductory video.

A new setting in the General Formatter Style options page (turned off by default) makes ReSharper C++ automatically detect and set the indent size used in a file. This feature becomes particularly handy in solutions where different files have variable indent sizes.

Indenting of preprocessor directives is now supported and controlled via the Indentation | Preprocessor directives indenting formatter option. Code that uses the OpenMP API is one example where this option is crucial for correct formatting:
Directives indenting

The list of other formatter options introduced for improved configurability includes:

  • Indent namespace members.
  • Break line in simple case statement.
  • Spaces within/after parentheses in cast expressions.
  • Place enumerators on new line.
  • Align multiline chained method calls and binary operators.

The list of small and not-so-small improvements in navigation and find usages includes:

  • The Find Results window now works asynchronously, meaning that you can work with the results tree while usage search is still in progress.
  • The Go to Everything and Go to Text popups support inline commands for advanced filtering of search results.
    Search filters
  • The Find Results window allows you to group results by kind of usage. This ability is very useful if you want to inspect only specific usage scenarios.
    Find results grouping
  • Recent Files can delete entries with the Delete key, and both the Recent Files and Recent Edits popups will now show the path of the file, to avoid confusion with similarly named files.
  • There is a new setting to remember the last search in Go to Everything, Go to Text and other search actions.
  • ReSharper’s Search & Navigation page adds a new option to open files in the preview tab from everywhere. This option is turned off by default.

ACCU 2017

The ACCU 2017 conference takes place in Bristol April 25-29 and as always has a great lineup of presenters and a lot of interesting talks, including “Functional C++ For Fun And Profit” and “A look at C++ through the glasses of a language tool” by our very own Phil Nash and Anastasia Kazakova. You can watch video recording on the ACCU conference YouTube channel later if you do not attend, but if you do, be sure to stop by the JetBrains booth to say “Hi,” grab a couple of souvenirs or shoot any questions at members of the ReSharper C++ and CLion teams.

That about wraps it up! All in all, 210+ issues have been fixed in the 2016.3 release iteration, and 140+ issues in 2017.1. We’d like to give a big shout-out to everybody who tried Early Access Preview (EAP) ReSharper builds and helped us iron out the bugs and improve the product. As always, please leave us any feedback and report issues either in the issue tracker or on the support forum. Develop with pleasure with ReSharper C++!

Download ReSharper C++ 2017.1

Posted in ReSharper C++ Tips & Tricks | Tagged , , , , | Leave a comment

C++ Annotated: Jan – Mar 2017

Today we are happy to share our next compilation of C++ news with you.

Subscribe to the regular C++ Annotated and be the first to get the next edition!

C++ Annotated: January – March 2017

In this edition:

C++ in 2017

The C++ ecosystem

logo-sunThis blog post about the C++ ecosystem in 2017 is worth a special mention. Written in January, it overviews nicely the main expectations and trends, and not just about the language. While C++17 is indeed the main topic for this year’s discussions (as well as the features that failed to be included and so postponed for the future), it is also about adopting new standards and libraries, and of course the community including user groups and conferences.


cpp_17As C++17 is approved, pending national body comments, there are lots of resources now where you can find the final feature list, explanatory code samples, committee meeting live threads and committee meeting trip reports. This list by Bartlomiej Filipek is quite useful as it provides code samples for each feature, lists the key compilers (GCC, Clang, MSVC) explaining the versions where the feature is supported, and links to various additional articles. It’s very detailed and includes every small change.
Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

C++ annotated: Sep – Dec 2016

Today we are happy to share our next compilation of C++ news with you.

Subscribe to the regular C++ Annotated and be the first to get the next edition!

C++ Annotated: September – December 2016

In this edition:

Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

Introducing Phil Nash, Developer Advocate for C++, Objective-C and Swift tools

Phil NashPhil Nash has joined us recently as a Developer Advocate for C++, Objective-C and Swift tools. Here we talk to Phil about his experience and interests and introduce him to all of you.

Twitter: @phil_nash
Blog: levelofindirection
GitHub: philsquared

A: Hi Phil, and welcome to the JetBrains team! Let’s talk about you. Can you please share a bit about yourself?

P: Hi Anastasia. Thanks for having me here. A bit about me? Well, I’ve been programming since I was 9. Like most who came of programming age in the early 80s, I started with various versions of BASIC on 8-bit home computers (ZX-81, ZX-Spectrum, Commodore-64, BBC Micro and others), but within a few years progressed on to assembler (mostly 6502 – but later 68000 on the Amiga, then 8086 on PC). In the early 90s I went for my first programming job, writing C & C++, which I prepared for by reading a book on C the night before. Somehow I managed to bluff my way in – but I hadn’t been there long before I realized I knew more C++ than anyone still there. That was the start of my C++ journey. It started on MS-DOS, but as the 90s progressed I naturally fell into Windows – which I did exclusively for the rest of the 90s.

A: What’s your background as a developer? I know you did C++ on Windows for a very long time. How did you end up doing iOS development in Objective-C and now Swift?

P: In the 2000s I changed things up a bit. The signs were there that C++’s heyday was coming to an end and I thought I should either learn other languages, or see which industries C++ would remain strong in. I started with the latter and moved into embedded programming – specifically mobile comms – where I stayed for about five years. It was a good experience and I’m glad I did it, but I also learned that embedded-programming was not for me. So I branched into banking, where I’ve mostly stayed until now. During that time, though, I also moved on the “other languages” front. First C#, then Python, then D and F#. At home I’d switched over exclusively to Macs, so I was interested in learning Objective-C, but it wasn’t until the iPhone AppStore launched that I gathered sufficient motivation to get past the initially steep learning curve!
Continue reading

Posted in Uncategorized | Tagged | 1 Comment

What’s New in ReSharper C++ 2016.2

As a part of ReSharper Ultimate 2016.2, our C++ team is happy to present the ReSharper C++ 2016.2 update. All in all, the new release comes with 200+ fixes and resolves several important performance- and stability-affecting issues. Let’s take a tour of the new features in this release.

Inline Variable

The mainline ReSharper’s refactorings continue to make their way into ReSharper C++. With the latest update, Inline Variable is now available for C++. This refactoring allows you to replace all occurrences of a variable in the code with its initializer. (The reverse functionality is already provided by the Introduce Variable refactoring.)
Inline Variable refactoring for cpp

Doxygen support

Doxygen is arguably the most popular format and tool for code documentation in the C++ world. ReSharper C++ now understands Doxygen syntax, and provides several key features to facilitate editing of documentation blocks:

  • Typing assist helps with creating new comment blocks and maintaining the structure of existing ones.
  • Code completion suggests Doxygen commands with accompanying short descriptions.
    Doxygen completion
  • Function parameter references introduced with \param commands will be reported by Find Usages and will get updated when Rename is used to change a function parameter’s name.
    Rename \param
  • Warnings are issued when function parameter references do not resolve to an existing function parameter.
    Unresolved \param

Documentation generation

You can now generate documentation for C++ declarators, classes and macro definitions. Since parsing a C++ file can require a significant amount of time, to avoid UI freezes this feature is implemented via a context action available when using Alt+Enter on the entity’s name.
Document context action
When the action is applied, ReSharper C++ uses the builtin doc live template to generate the resulting comment. The default documentation template is configured to be compatible with Doxygen syntax, but it can be customized (as usual) using the Templates Explorer tool window. An assortment of specialized documentation macros can be used inside the template, which evaluate to:

  • Short or qualified name of the entity that is being documented.
  • Function/macro/template parameter name or type (the containing template line is duplicated for each corresponding parameter).
  • Function return value, if there is one.

Quick Documentation

Thanks to Doxygen support, Quick Documentation now works in C++. The documentation pop-up (bound to Ctrl+Shift+F1 in the Visual Studio scheme or Ctrl+Q in the IntelliJ IDEA scheme) will display documentation from Doxygen comment blocks, or the symbol’s signature if no documentation is found.
Quick documentation pop-up

Code analysis

ReSharper C++ now understands several of the standard C++11 attributes and their Visual C++ counterparts:

  • Usages of functions and classes marked with [[deprecated]]/__declspec(deprecated) are reported together with the specified reason.
    Highlighting of a deprecated function
  • Not all control paths return a value and other control-flow based analyses correctly handle functions marked with [[noreturn]]/__declspec(noreturn).

Most header files should start with some form of include guard to avoid multiple inclusion. Similar to the Missing precompiled header include for .cpp files, ReSharper C++ will now warn you if a header file lacks an include guard and will provide a fix to automatically add a #pragma once directive.

Omitting noexcept specifications from user-defined move constructors and assignment operators can have serious performance implications (for an in-depth discussion refer to this blog-post or Item 14 of Scott Meyers’ excellent “Effective Modern C++”). To make sure this is intentional, ReSharper C++ will warn you about move constructors, move assignment operators and swap functions without an explicit noexcept specification, with corresponding fixes to add one.
Move constructor without noexcept

Starting with Visual Studio 2013, the Visual C++ compiler has supported explicit user defined conversions. To complement the existing Non-explicit converting constructor inspection, Non-explicit conversion operator was added. Severity for both analyses is set to Hint by default (so they are not shown as suggestions), but can be increased if you prefer to avoid implicit user-defined type conversions.
Non-explicit converting constructor

In addition to suggesting to replace zero constants with nullptr in pointer contexts, ReSharper C++ will also offer replacing integral constants with true/false in boolean contexts.
Replace expression with true

Last but not least, another new inspection detects missing default cases in switch statements and provides a fix to insert it. The same fix is also available for the Uncovered enumerators inspection.
Default case

Go to Text

A new member of the Go to family, Go to Text navigation (Ctrl+T,T,T in the Visual Studio keyboard scheme or Ctrl+N,N,N in the IntelliJ IDEA scheme), lets you quickly find and navigate to any text in source and textual files in the entire solution.
Go to text
This new feature uses trigram indexing to make text search blazing-fast. Similar to other navigation commands, if there are too many matching items you can press + on the numeric keypad to explore results in the Find Results window.

New code style options

New formatter options provide support for some commonly used styles in C++ code:

  • The Braces Layout | Keep simple compound statements in one line setting was added to allow single-line definitions of trivial functions. It can be set to force ReSharper C++ to make such functions single- or multi-line, or to simply not change their formatting.
    Keep simple compound statements in one line
  • A related setting, Blank Lines | Around single line function definitions, controls the number of blank lines that a single-line function should be surrounded with.
  • The Wrapping and Aligning | Break line before member initializer list option controls whether to start member initializer lists on a new line.
    Break line before member initializer lists

Different projects use different conventions for the syntax of #include directives – as a result, we received several requests to make auto-generated #include directives more customizable. ReSharper C++ now provides preferences about whether to insert paths relative to the current file and when angle brackets should be used instead of quotes.
Include directives settings

A couple of settings were added specifically for compatibility with pre-C++11 codebases:

  • Formatter gets an option to require a space between closing angle brackets in template arguments, to avoid a notorious parsing issue in C++98.
    Space between closing angle brackets in template arguments
  • Instead of nullptr, ReSharper C++ can be configured to use NULL or 0 for default pointer initializers.
    Default pointer initializer

Generate improvements

In addition to Google Mock, the mock function generator now supports Trompeloeil. Trompeloeil is a modern header-only C++14 mocking framework, and is a great alternative to Google Mock when your project needs a mocking library but does not use Google Test. As with Google Mock, the generator becomes available when ReSharper C++ detects that the library is included into the current source file.
Trompeloeil mocks

Several existing code generators received new options:

  • To complement the related code analysis, copy/move operations and swap function generators allow making generated functions noexcept.
  • Similar to relational operators, the equality operator generator now has an option to use std::tie.
  • The constructor generator now lets you specify the accessibility of generated constructor(s) (starting with ReSharper C++ 2016.2.1).

Auto-import completion

Code completion in C++ became integrated with auto-import and can suggest symbols that are not included into the current file. The necessary #include directives are added automatically when an auto-import item gets used.
Import suggestions in C++ auto-completion
Please note that auto-import items get added into the completion list asynchronously, so they will be available after a short delay.

Code template enhancements

If you need to surround a piece of code with a template, just select the code and type in the name of the template you need: no extra shortcuts required. Furthermore, a single template can now be used for creating code (as a live template) and for surrounding existing code (as a surround template).
Surround templates

The default C++ class and struct file templates now contain a macro that expands into an #include directive for the precompiled header file, if the project uses one.

Odds and ends

Keeping up with the language evolution, ReSharper C++ extends its support of the C++14 standard. In particular, variable templates and decltype(auto) are now supported.

When your caret is on one of the exit points of a function/loop/switch (return, throw etc.), ReSharper C++ will automatically highlight all other exit points.

Similar to Visual Studio’s __INTELLISENSE__ define, ReSharper C++ now defines its own __RESHARPER__ macro in the internal preprocessor implementation. If necessary, this definition can be used to guard code that ReSharper C++ does not understand for some reason, or to hide parts of a file from code analysis.
__RESHARPER__ define

CppCon 2016

If you are attending CppCon 2016, be sure to stop by the JetBrains booth September 20-21! Members from both the CLion and ReSharper C++ teams will be present, and we will be happy to tell you all about our products, share future plans and answer your questions. Don’t miss your chance to participate in our license raffle and win a free 1-year subscription for any JetBrains C++ product of your choice!

CppCon 2016

As always, we would like to hear your feedback – and if you have any problems or feature suggestions, do not hesitate to contact us or create a request in our issue tracker!

Posted in ReSharper C++ Tips & Tricks | Tagged , , | 3 Comments

C++ Annotated: Jun – Aug 2016

Today we are happy to share our next compilation of C++ news with you.

Subscribe to the regular C++ Annotated and be the first to get the next edition!

C++ Annotated: June – August 2016

In this edition:

  • Interviews
  • Conferences
  • News & Stories
  • Releases


Jon Kalb speaks about CppCon, C++17 standard and C++ community


These months were quiet in terms of conferences, but September is just around the corner with the most well-known and significant event in the C++ world – CppCon. CLion’s PMM, Anastasia Kazakova, talked to Jon Kalb, CppCon Chair and C++ instructor. The first topic discussed was the C++ community and how modern language features are adopted by it. They went on talking about Jon’s feeling towards C++17 and his strong faith that the committee did everything just right. Jon also shared a secret recipe and a magic ingredient of CppCon success and a story of CppCat, and spoke about the era of tools for C++.

An interview with Sean Parent


Jens Wellers from Meeting C++ did an interview with Sean Parent. Learn why Sean would select Argument-Dependant Lookup if he could remove one feature from C++ language; why he thinks garbage collection has no place as a part of the general allocation scheme; discover his views on functional programming, smart pointers, coding guidelines and a bunch of other topics.

Stephen Kelly at CppCast


During these months many interesting episodes of CppCast were published. One of them is an interview with Stephen Kelly, Qt and CMake expert and maintainer. He talks about Qt build system and CMake similarities and how they can co-exist. While the most interesting part of the interview is dedicated to CMake API and how tools like IDEs can use it to integrate deeper with CMake, Stephen also answers questions about its design and why they dropped the idea of simply generating more content on a CMake call and decided to use the idea of the CMake server instead. In the end, Stephen shares some tips on CMake productive usage, like creating and using CMake config files.

Another great episode of CppCast worthy of a mention is an episode with Herb Sutter reviewing the results of the Oulu C++ committee meeting.
Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

C++ Annotated: March – May 2016

Today we are happy to share our next compilation of C++ news with you.

Subscribe to the regular C++ Annotated and be the first to get the next edition!

C++ Annotated: March – May

In this edition:

  • Conferences
  • News & Stories
  • Webinars
  • Releases


ACCU 2016

accu In April, ACCU came back to Bristol, UK, as usual. The premier UK developer conference this time brought together more than 400 attendees and over 60 speakers. Four playlists with video recordings, one for each day, are already available on YouTube. Lots of interesting topics were covered this year, for example Greg Law’s talk about profound and thus less known GDB features, Diego Rodriguez-Losada’s talk about C/C++ and Python working together, a talk from our developer advocate Dmitri Nesteruk about Design Patterns in Modern C++, and many more.

Besides, ACCU 2016 Chair, Russel Winder, gave JetBrains an interview where he talked about things that make ACCU unique, as well as his experience with Rust, D and Go languages and their future in comparison to C++.

C++Now 2016

cppnow Across the pond, C++Now 2016 was held in Aspen, Colorado, in early May. Attendees could find a lot of well-known names from the C++ community joining the event, like Sean Parent from Adobe with a keynote talk about Better code, Jon Kalb with his famous O’Reilly report about C++ landscape overview, Timur Doumler, a JUCE developer from ROLI, Marshall Clow, Barbara Geller, David Sankel, and many others.

Check out the best session winners and learn about C++Now 2017 dates in the blog post.

Italian C++ Conference 2016

Another C++ event was held in Italy in May. More than 100 people attended the very first Italian C++ conference in Milan. You can find the report about the event here. In particular, we want to draw your attention to two of James McNellis’ talks, Adventures in a Legacy Codebase and An Introduction to C++ Coroutines.

News & Stories

C++17 standard news

cpp March brought several reports about the C++ meeting in Jacksonville, Florida. Herb Sutter posted a long and detailed one in his blog. Despite many expectations and hopes in the C++ community, modules and concepts won’t come to C++17. However, for now they will both stay in their own technical specification. Coroutines are targeted for another TS as well. On the good side, Herb lists the features that are making their way to the upcoming C++ standard, like Parallel STL and several more TS that were merged into the final C++17 edition, and several features coming directly to the new standard like fallthrough, nodiscard and maybe_unused attributes and more. The future of C++ is presented in Herb’s blog post in a simple timeline, followed by an interesting open-ended question: Will C++ stay on the 3-year cycle or move to a 2-year cycle?

C++11 smart pointers

C++ developers (both students and professionals) can find this blog post useful, as it uncovers 10 dangerous pitfalls when working with C++11 smart pointers. It tells you where it’s better to use shared_ptr, unique_ptr and auto_ptr; how to avoid double memory allocation by using make_shared; and lays out the rules for working with the raw pointers.

lambdas and std::function

lambda C++11 lambdas are already widely used. The idea is pretty simple. The easiest (though probably useless) example is “[](){}();”. But do we know them well enough to answer even basic questions? What is the lambda’s type and why is it not std::function? How long do the variables captured by lambda stay alive? What is the size of a lambda? If you feel like testing your knowledge of lambdas, head straight to this blog post.


conan In the previous edition we already mentioned Conan, a C/C++ package manager. This time we’d like to share more information about it. First up is a CppCast episode with Diego Rodriguez-Losada, known as a biicode startup co-founder and currently Conan committer. Watch the episode to learn the Conan story first-hand.

There is also a great post in Conan’s blog for those interested in setting up a full environment for C/C++ development based on Clang as the compiler, CMake as the build system, CLion as the IDE, and Conan as the package manager. Check the steps and follow advices for an easy set-up.

Compiler Bugs Found When Porting Chromium to VC++ 2015

64_read Bruce Dawson from Google posted some great material on the bugs found while porting a big Chromium project from VC++2013 to VC++ 2015. The incredible work includes attempts to build some smaller samples to reproduce the problems, as well as some deeper analysis of the situations. Read the post to know about a problem with zeroing a five-byte array, a crash that would happen only under Profile Guided Optimization, an incorrect 64-bit structure read, and more.

Telemetry function calls in VS 2015

telemetry Recently the C++ community has been discussing the telemetry call in every binary compiled in VS2015. The discussion was huge as conspiracy theories are always popular, even though the logs written in that case were quite limited and have to be switched on manually (so not working by default).

However, the discussion on reddit got an official comment. Steve Carroll from the Visual C++ team has promised that the corresponding calls will be removed in Update 3. He explained that the main intent was to build a framework that would help investigate performance problems and improve the quality of the optimizer.

C++ I/O Benchmark

compilers Cristian Adam posted in his blog nice and solid benchmark for C++ cross-platform calls for Input/Output on Windows 10, Kubuntu 15.10 and Raspberry PI2, testing on a huge set of compilers: GCC, Clang, Visual C++ (2013/15), MinGW GCC, Cygwin GCC and Cygwin Clang. During the test he was reading one file in chunks of 1 MB and writing it to another file. The tested API calls were: C file API (fopen, fread, fwrite), C++ API (std::ifstream, std::ofstream) and POSIX API (open, read, write). And the winner’s crown went to… POSIX. See the full blog post for some interesting numbers.


CppCast continues gathering famous C++ community members. Jens Weller talked about the Meeting C++ platform that brings the conference, site and recruiting platform to the C++ world. Get the whole story first-hand. An interview with the author of the renowned blog Simplify C++, Arne Mertz, was recorded for CppCast in March. Find the discussion of the latest standard and more topics in there. April brought an interesting discussion with Ankit Asthana about cross-platform development, Visual Studio Code and Visual Studio for Linux. Elena Sagalaeva (known by the Russian-speaking community for her famous blog on C++ in Russian) attended the podcast in April as well, talking about distributed computing and how the latest C++ standards are useful there.


Design Patterns and Modern C++

The recording of our May 24th webinar, Design Patterns and Modern C++, is now available on JetBrainsTV YouTube channel. In this webinar Dmitri Nesteruk shows how the classical design patterns that arose in 1994 from the infamous Gang of Four book continue to be as useful to this day. We are discussing the adapter pattern, the builder pattern and the maybe monad. Several questions from the webinar answered by Dmitri can be found in the corresponding blog post.


GCC 6.1

gcc-logo The new major release of GCC compiler was announced and brought lots of goodies. First of all, C++14 is set as a default. Besides, many features from the upcoming C++17 were added to the compiler (for both language and standard library), and even Concepts, that were postponed by the committee to another TS, are available in GCC 6.1 via -fconcepts.

Checking the list of the General Optimizer Improvements in the release notes, you may notice an interesting point that C++ developers definitely should heed: “Value range propagation now assumes that the this pointer of C++ member functions is non-null”. You may want to check whether your code base is affected by the change, just as it happened to Qt5, Chromium and KDevelop. Anyway, GCC authors suggest a temporary workaround: -fno-delete-null-pointer-checks.

Clang 3.8

libclang A lot of goodies were delivered with the Clang 3.8 release, including OpenMP 3.1 (and several elements of the OpenMP 4.0/4.5), experimental support for end-to-end CUDA compilation, static analyzer improvements, and more. You can also track the progress of the new features through the Clang 3.9 (in progress) release notes.

ReSharper C++ 2016.1

R++_400x400_Twitter_logo_white April brought the release of ReSharper C++, a Visual Studio extension for C++ developers. In addition to Google Test support, Boost.Test is now added, including a built-in test runner. This version allows you to mark your code with TODO, BUG, FIXME or any other pattern you may prefer (configurable in settings), and navigate through the marks easily using a special Todo Explorer.

The release also brought a long list of new quick-fixes and context actions that help improve the code, by suggesting various fixes. One example is when ReSharper C++ detects an uninitialized constructor parameter, it offers a context action to create and initialize the corresponding field. Find more details about the new version in this blog post.

CLion 2016.1

CLion_400x400_Twitter_logo_white CLion, a cross-platform IDE for C and C++ developers, got an important update. Release 2016.1 finally brought variadic templates support and auto-import for STL symbols. Quick Documentation pop-up was enhanced with the hyperlinks to the related symbols. During debugging users are now allowed to attach to the process running on a local machine but not started from the IDE – all the benefits of the built-in debugger UI are still there.

To speed up the indexing time, CLion 2016.1 lets you mark directories as excluded (several more option like libraries or sources are also available).
Overgrowing just C and C++ development, CLion turns to the multi-languages projects bringing Python and Swift support on board. Feel free to check the details in the CLion’s blog.

Finally, CLion started a new Early Access Program for version 2016.2. This build addresses Doxygen support, Complete Statement and VCS changes, CMake rename refactoring for users symbols and more.

Qt Creator 4

qt Qt came out with big news in May and released Qt Creator 4.0.0. It includes CMake workflow changes (like automatic triggering when necessary, UI to change the CMake configuration for a build directory and more), automatic use for the Clang code model, Clang static analyzer integration available under open source, fixes for the latest LLDB version and several more improvements.

Visual Studio 2015 Update 2

vs_cpp Microsoft has given us a lot of exciting news in these months. Update 2 comes with many interesting changes for C++ developers. C++ compiler got many bug fixes, with the most notable changes including support for Variable Templates and constexpr improvements. At the same time, many C++17 features have made their way to C++ standard library as well.

However, the biggest improvement is probably for those who develop for Linux, as the new extension makes possible C++ development in Visual Studio for Linux. You can now create projects and manage connections to the Linux machine right from the VS. Upon connecting, VS will copy your sources to the remote Linux machine and will invoke GCC to build the sources with the options from the project properties. Then you can debug your code remotely.

Looking into the future of Visual C++ compiler, read this blog post about upcoming changes in Visual C++ code optimizer. Find out the reasons behind the new optimizer, and see several samples of implemented optimizations.

That’s it! Let us know in the comments if you like current edition.

The C++ Team

Posted in Uncategorized | Tagged , | 1 Comment

What’s New in ReSharper C++ 2016.1

Apart from the change in version numbers, ReSharper C++ comes with plenty of new features as well as improvements to existing functionality. Here’s what we’ve got in store for you with this release.

Boost.Test Support

The previous release of ReSharper C++ provided a unit test runner for Google Test — well, this one augments this with Boost.Test support. This includes all the usual refinements users of our unit test infrastructure are used to. ReSharper will detect individual Boost tests as well as test suites:

ReSharper C++ Boost.Test Detection

There is also support for test labels:

ReSharper C++ Boost.Test Label Support

And of course it will use its unit test runner to actually run those tests and show a listing of the results.

ReSharper C++ Boost Unit Test Runner

Please note that Boost.Test support requires Boost 1.59 or later.

Todo Explorer

The Todo Explorer is a separate tool window that has long existed in the original ReSharper but is now coming to ReSharper C++. Its goal is to find text that matches a specific pattern in comments, strings or identifiers and show all the located elements in a single, easy-to-browse list:

ReSharper C++ Todo Explorer

There are plenty of filtering and grouping options in this window, and double-clicking each element takes you right to the line of code where the relevant piece of information was found. ReSharper comes with support for TODO and BUG in comments, but you can easily add other markers or create new ones:

ReSharper C++ Todo Explorer Edit Pattern

As the above screenshot demonstrates, you can define the regular expression to search for, the type of code element (comments, strings, identifiers) to search in, and you can also control the color that’s used for this type of item in the Todo Explorer.

Context Actions and Quick-Fixes

As with all releases, we keep expanding the set of context actions and quick-fixes that ReSharper C++ provides. Here are a few examples.

If an out-of-class member function signature fails to match the prototype in the class body, ReSharper C++ now offers two quick-fixes to change that:

ReSharper C++ Change Signature

Choosing Use signature…, the signature of the function definition will be changed to the one of its declaration. Choosing Change signature… does the reverse, changing the declaration so that it matches the definition.

ReSharper C++ Change Signature Refactoring

When ReSharper C++ detects an uninitialized constructor parameter, we now offer a context action to create and initialize the corresponding field

ReSharper C++ Create and Initialize Field

When ReSharper C++ detects possible unintended object slicing, it offers the option to perform a static_cast:

ReSharper C++ Possible Unintended object slicing

If the type of variable being returned from a function does not match the type in the function signature, ReSharper C++ offers the options to adjust either the return type or the type of variable being returned:

ReSharper C++ Incorrect Return Type Quick-Fix

In fact, we have a more general mechanism for detecting type mismatches: for example, assigning an int variable a string literal will present you with the following:

ReSharper C++ Change Type

If you try to assign a read-only member in a const function, ReSharper C++ now offers you quick-fixes to either to make the member mutable or make the function non-const:

ReSharper C++ Make Member Mutable

If a base class or its function has a final modifier, ReSharper C++ will highlight the error over both the final keyword as well as any overriding classes and offer you a quick-fix to make the base class non-final:

ReSharper C++ Remove Final Keyword

New context actions are also provided to flip operator arguments and negate boolean expressions:

We’ve added fixes and context actions for working with includes: analyses related to precompiled header usage, context actions to normalize slashes in include paths, support for replacement of quotes with angle brackets (and vise versa).

ReSharper C++ Quote Replacement

In addition to the bulk generate definitions action, we now have bulk Move Function Implementations context action. Simply select several function bodies and press Alt+Enter:

ReSharper C++ Move Function Implementations

Rename Refactoring Improvements

And there are additional fixes, too. For example, the Rename refactoring now works on files, and will rename both the file as well as any usage (e.g., in #include directives) of the file:

ReSharper C++ Rename Refactoring on Files

It’s also worth noting that the Rename behavior on an ordinary class will now affect the header/cpp filenames, too.

Code Generation

We’ve made improvements in the code generation functionality. For example, when generating relational operators, ReSharper C++ now offers the option of using std::tie:

ReSharper C++ Code Generation Relational Operators std::tie

Another feature we’ve added to the Generate stream operations feature is the support for the use of Boost for purposes of serialization:

ReSharper C++ Stream Output Private Boost.Serialize Operations

And a Few More Things

Starting with version 2016.1, the Find Code Issues functionality works in the background in both ReSharper and ReSharper C++. This lets you keep editing or navigating your code while ReSharper runs its analysis.

The list of C++ language features supported by ReSharper C++ has also been extended with support for generalized lambda captures, exception specifications and inheriting constructors. We also have formatting options now being taken into account when generating code.

The formatting settings have a new page for controlling blank lines.

Finally, all ReSharper C++ actions are now actively banned from changing the code of any of the C++ libraries that you might be using.

So that’s it! Enjoy the new release of ReSharper C++, and be sure to let us know what you think!

Posted in News & Events, ReSharper C++ Tips & Tricks | Tagged , , | 5 Comments

C++ Annotated: Dec – Feb edition

Today we are happy to share our next compilation of C++ news with you.

To subscribe to regular C++ annotated use this simple form and be the first to get the next edition!

C++ Annotated: Dec – Feb

In this edition:

  • Conferences
  • News & Stories
  • Releases


Meeting C++

Meeting C++ 2015, the final C++ event in the year, was held in Berlin, December 4 & 5. Focused on Embedded Development this year, it was a great meetup for C++ developers from Europe and all over the world. Lots of interesting topics were covered, from the fantastic opening keynotes by Chandler Carruth about “Understanding Compiler Optimization” and James McNellis talking about “C++ Coroutines” to interesting lightning talks like Daniel Jasper’s about clang-tidy. There is a playlist available on YouTube with all the videos from the conference. Go on and check the topics you are mostly interested in!

meeting_cppBy the way, it was great to meet so many C++ developers at our booth at the conference. Thank you for coming up with lots of interesting questions. See you next year!

JetBrains C++ team in San Francisco in March

Our C++ team is up for a couple of big events in San Francisco area this March. We are happy to be the part of the world’s largest and longest-running professionals-only game industry event – GDC 2016 (join us at booth 1743). And in case you prefer local meetups – come and see us at San Francisco Bay Area C++ user group meetup (March 15) and Association of C/C++ Users’ Silicon Valley user group meetup (March 16).
Continue reading

Posted in News & Events | Tagged , | Leave a comment