C++ Annotated: Jun – Aug 2016
Today we are happy to share our next compilation of C++ news with you.
C++ Annotated: June – August 2016
In this edition:
- News & Stories
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.
CppCon 2016 program
CppCon 2016 will start in Bellevue, USA, in September. In July the program was announced, bringing a philosophical keynote by Bjarne Stroustrup (The Evolution of C++: Past, Present, and Future), a talk about the concurrency from Anthony Williams, one of the original authors of Boost.Thread and the author of C++ Concurrency in Action, well-known Hans Boehm will be talking about atomics; there will be several talks of interest to the financial industry, thoughts and experience shared by the CppCast hosts in the talk called What We’ve Learned From the C++ Community and more famous names and interesting topics. Have you booked your ticket already?
Meeting C++ 2016
Another C++ conference, Meeting C++ that will be held in Berlin, in November, also published the program. It’s also going to be opened with the keynote by Bjarne Stroustrup, some talks and speakers will be shared with the CppCon program. However, some unique talks are planned as well, for example Phil Nash with Functional C++ for Fun and Profit, trying to see if we can actually do functional programming in C++. Check the program to get more details.
ADC 2016 powered by JUCE
Last year JUCE conference had a huge success and turned this year into the Audio Developer Conference. Julian Storer, the author of JUCE framework, will be accompanied by 30 other great speakers in London in November, talking about modern C++ and its adoption in audio development area, JUCE framework and its usages, as well as several interesting tools and solutions for the area. Check the full program announced on the site.
News & Stories
C++17 Committee Draft
C++17 is just around the corner! After the C++ committee gathered in Oulu, Finland, the final list of C++17 features was built, and the committee finally shipped the Committee Draft, which means that no new features will be added to C++17 from now on. A short summary of the new additions voted into the C++17 working draft at the meeting in Oulu can be found at reddit. It includes dynamic memory allocation for over-aligned data, template argument deduction for class templates, and other features. Check the full list on reddit with the links to the proposals.
Top 15 C++ Exception handling mistakes
Deb Haldar from Microsoft points out 15 mistakes that C++ developers used to make when using the exceptions handling mechanism. He discusses performance and code size criteria, gives a short overview of the stack unwinding process and code flows where exceptions should not be used (since the function can actually recover from the problem). There are also arguments as to why exceptions could be included into constructors and what’s wrong with them in the destructors. More tricky tips include throwing by value, catching by reference, deriving from
std::exception or subclasses, and more.
The story of Coati
This instructive story of a Google internship that leads to the creation of Coati, a cross-platform source explorer for C/C++, touches on the problem all the developers meet. Reading code takes most of the developer’s time and a good instrument is often lacking here. Such tool should make it possible to easily collect information about class instantiations, look up interface implementations, search for function calls, etc. The results output format is crucial as it should be easy to read. This all leads to a popular idea of interactive visualization. If you are interested in the suggested solution, check Coati’s home pages.
Understanding C/C++ pointers
If you ever had hard time understanding C/C++ pointers, this blog might be of interest to you as it includes a nice series of blog posts dedicated to C/C++ pointers, their behaviour and interesting facts that are not that obvious at first glance. Why does the type of the value to which the pointer points matter? How can the value be passed in pointers? Is an array function argument better than a pointer? Find answers in the blog posts dedicated to C/C++ pointers.
Vision for the Future of C++ from LoopPerfect
LoopPerfect is a company behind Jyt, a just-in-time compiler for C++. In their blog they are analyzing programming languages popularity trends and offering one more advantage C++ could have – rapid development times using just-in-time compilation. They suggest the hot reload solution be added to C++. Check their demo to see how it works, and who knows, maybe this will be the future of C++…
C to Rust translation
The Rust language is designed to be safe and concurrent. Its popularity grows fast, especially after version 1.0 was released. Thus projects like Corrode, an automatic semantics-preserving translation from C to Rust, are becoming more popular as well. As stated on its GitHub page, Corrode can be useful for both migrating the legacy code that was implemented in C and serving as a complementary approach to static analysis for C programs. The latter is actually quite interesting. Taking into account that translation can either success or fail, the user can either run checks provided by the Rust compiler (missing from the C one) or suggest that the translation failed because of some potentially hidden bugs and try searching for them.
Refactoring Session from Arne Mertz
In his second session dedicated to code refactoring, Arne Mertz eliminates code smells from a real-world code sample. He pays attention to poor naming; classes derived from standard containers, which is strongly not recommended; some unnecessary manual implementations of the standard algorithms; out-parameters usage instead of a normal return value. The second step was focused on the main algorithm itself, constructing a new class and extracting several separate functions. At the end of the day this sample works as a good tutorial on how to eliminate code smells and refactor them.
Conan virtual environments
Conan, a C/C++ package manager and a part of so-called 4C development environment, posted an article about easy managing of applications that developers use to build software (and especially useful for CI purposes). This is a new feature of Conan 0.11 release and it allows you to easily configure all the parameters of the environments, like the actual set of tools, their versions and options used during installation. There is also a way of creating conan packages for any tool. Check the article to learn more details.
CLion team shared the story of their collaboration with the Toolbox App team, who is currently one of the CLion’s users inside JetBrains company. The solution manages all JetBrains desktop tools, taking care of installing new versions, cleaning up old ones, getting updates, or rolling back. It consists of a native Qt-based application written in C++, embedded browser (with modern web technologies used) and JSON and Kotlin server side. As CLion covers nearly perfectly all the needs of the client-side part, it quickly became the tool where Toolbox App can be “just opened and started”, despite a few issues.
1.5 year ago the C++ community got CppCast, a podcast by C++ developers for C++ developers, hosted by Rob Irving and Jason Turner. And approximately a month ago Jon Kalb (whom Herb Sutter called a rising star in the C++ community) started CppChat, which is a live conversation about the latest news in the C++ world. One can join the Hangout streaming or watch the episodes later on Jon’s YouTube channel. Together with Bryce Adelstein Lelbach, Jens Weller, Matt Calabrese, Howard Hinnant, Richard Thomson and others, they discuss lots of hot C++ topics: Meeting C++ and CppCon’s programs and keynotes speakers, language features and upcoming C++17 standard and committee decisions, Boost, CMake and much more.
PVS-Studio and Linux
PVS-Studio is a code analysis tool that helps users catch bugs in programs in C, C++, and C#. For C and C++ it allows catching problems related to 64-bit usages, arithmetic over/underflows, array index out of bounds issues, double-free situations, unreachable code, unused variables, and much more. After being a Windows-based tool for a long time, with Visual Studio and MinGW language dialects support, it now comes to Linux with plans to support GCC and Clang. In the blog posts Andrey Karpov shares the plans, describing what there is behind compilers support and why it’s not that easy, why they need to get a collection of source code samples with a vast range of language features used, what compiler runs the monitoring system they wish to implement and other related tasks.
If you used the Sublime text editor for your development, you probably heard about multiple cursors. CLion has this feature too, adding smarter support to it ( for example, live templates working by multiple cursors). The post from CLion’s blog explains how to work with multiple cursors, as well as lists smart actions that are available by them. It also demonstrates where it’s better to avoid multiple cursors and use refactorings and code generation features instead.
The second major update this year for CLion brought lots of long-awaited features like remote GDB debug (on Linux and macOS) together with dozens of debugger fixes and performance improvements, the Doxygen support (including function and function parameters renaming with automatic update of Doxygen references, completion and comment stubs generation), operators generation, several smart features for CMake. It also includes IntelliJ-platform improvements like font ligatures, background images, VCS patches workflow improvements and more. Check the overview demo to learn about new features and read details in CLion’s blog.
If you are wondering what’s next and looking for the ability to watch the command output during CMake execution, remote debug on Windows, user-defined literals support and other requests, check the roadmap post.
ReSharper C++ 2016.2
ReSharper C++, Visual Studio Extension for C++ Developers also came with a second major update this year. ReSharper C++ 2016.2, as well as CLion, shows the Doxygen documentation in the newly added Quick Documentation pop-up. Doxygen comments stubs generation, completion, find usages and rename refactoring are supported as well. Apart from the documentation features, ReSharper C++ introduced several new inspections and quick-fixes and new code style settings. Autocompletion adds the missing includes, so you can complete symbols that are not yet included in the current file. Find out more details about ReSharper 2016.2 on the site.
Visual Studio Code C/C++ extension update
Ankit Asthana shared some new features added to Visual Studio Code for C and C++ along with another update. The debugger part looks interesting now with LLDB support for macOS and the process picker to attach to a running process. Another great feature is the ability to limit symbol processing to the included headers only to speed up the code-navigation experience. And in case you’d like to share your feedback with the team, there’s a link to the survey at the beginning of the post.
The C++ Team