C++ Annotated: Sep – Dec 2017
Today we are happy to share our next compilation of C++ news with you.
C++ Annotated: September – December 2017
This last part of the year 2017 has been full of great conferences and meetups, hot discussions in the committee on C++20, interesting articles, and big releases. And, of course, the biggest news – C++17 is now officially signed and published! 🎉
In this edition:
CppCon is the main event in the C++ world. Dozens of great speakers every year bring to Bellevue, WA, new ideas from various areas of C++ development, present future language features, and demo the tools and libraries of tomorrow. Attendees always leave CppCon inspired and encouraged, and eager to check out all the sessions they missed on YouTube. The conference is growing and this year gathered more than 1000 attendees! There were traditional keynotes from Bjarne Stroustrup dedicated to Learning and Teaching Modern C++. Herb Sutter talked about his Metaclasses proposal. Matt Godbolt was the real star of this year’s event delivering a fantastic presentation on Compiler Explorer history and tricky findings. Titus Winters presented Abseil, an open-source collection of C++ library code from Google, bringing a discussion on dependency and package managers to the table (and the Conan team was also presenting a full-size talk!). There were other talks worth watching, covering topics like tricky function default arguments, state of modules implementation in GCC, reverse debugger, fuzzing techniques, and many others. Our JetBrains team also did a few talks. All the recordings are available on YouTube.
The trip report by JetBrains is available on our blog and presents interesting findings of the attendee’s preferences for C++ standard and compiler. Other trip reports are linked to the official CppCon blog post.
On the other side of the pond, in Berlin, Germany, one of the major European C++ events happened in November – Meeting C++. It was at the same time as the C++ committee meeting in Albuquerque, New Mexico, USA, thus committee members, unfortunately, didn’t make it to Berlin. That probably made the event even more interesting and diverse, as many other speakers managed to present a talk. It was a three-day long event (instead of two as before), and it gathered speakers from across the world. Keynotes were provided by Sean Parent (on the importance of the UI/UX in software design), Kate Gregory (on the need for simplicity in a world of complicated C++ code) and Wouter van Ooijen (on the embedded specifics), and there were also other impressive talks.
Besides this, I want to specifically mention the Secret Lightning Talks, which were a surprise to the audience and brought on stage some great community members. The topics varied from a discussion of the diversity by Guy Davidson and the great and inspiring life experience from Kate Gregory, to an elegant compound command line parser by Phil Nash, and many others. At this very moment, just a few videos are available, but you can check some trip reports by Simon Brand, Arne Mertz, Codeplay, and others.
If you are engaged in audio development, you should definitely pay attention to the ADC (former JUCE) conference, held yearly in November, in London. But even if you aren’t, you might want to check out the recording from the C++ track. There were talks on the general overview of the C++17 features and their benefits for real-time apps, a more detailed talk on std::variant, and talks about developer tools and interesting data structures. All the recordings are available on the YouTube channel.
There are hundreds of C++ user groups around the world. But what if there is no C++ user group near you? One answer would be – organize one (see these tips from Meeting C++ if you decide to set one)! Besides that, do you know that user groups sometimes record their talks and publish them later on? Of course, it can’t replace the fantastic live interaction with the C++ community from your area, but it can still provide you with some good learning content. Let us all share the knowledge! Feel free to post links to the user group recordings you know about here in the comments. We can suggest SwedenCPP (the talks are in English), St.Petersburg C++ (some talks in English, others are in Russian), C++ Russia (UG and conference recordings, mostly in Russian) channels to start with. What are yours?
By the way, have you ever thought of a distributed meetup? Check out the first experience by the London C++ and SwedenCPP user groups.
Titus Winters presented Abseil libraries at CppCon. Extensively used within Google, this collection presents an interesting idea for C++ language standard compliance. What if you are still bound to C++11 but want to start using features incorporated into C++14, C++17, and beyond? Abseil libraries help with some forward-compatible abstractions similar to such new features. Along with Titus’s keynotes at CppCon, there is a CppCast episode available on the topic.
The great thing is that Matt Godbolt added the Abseil master to Compiler Explorer right after the announcement, so you can try them there. And this was also an interesting addition to the currently hot – dependency and package manager discussion, libraries variety, compatibility and other related topics.
At Meeting C++ 2017 Arne Mertz (the author of the Simplify C++! blog) presented a comprehensive overview of the review process. He also posted a series on his blog dedicated to the topic. Part 1 addresses the question: why do code reviews at all? While analyzing various reasons like QA and searching for bugs, code quality and performance, and an opportunity to learn and get familiar with the code, Arne still suggests thinking if an alternative to the code review works better for the goal. General suggested principle is clear and reasonable – “keep what works well, improve or remove what doesn’t”.
Part 2 answers the question what to review. Features are obvious candidates, but there are more of course, like bug fixes, tests, code that passed a refactoring, documentation, configuration file, CI files, and installation scripts to name a few.
Programming for microcontrollers in CLion
A second guest blog post by Ilya Motornyy from Vaadin helps you start easily with programming for microcontrollers in CLion. Ilya implemented a plugin to convert a project made in STM32CubeMX into a CLion project, download some necessary firmware and debug on chip. In the blog post he demonstrates how to install the plugin, set the toolchain, configure a board (a very popular STM32F4-Discovery is used for the demo) and generate a project for CLion. Besides, the plugin helps with OpenOCD (an open source on-chip debugger) configuration, so a sample with the debug on ship is presented. Find a small video and QA section in the end.
Functional Programming in C++
In C++Truths blog by Sumant Tambe, you will find an interesting video about functional programming in C++. It has a connection to the upcoming book by Ivan Čukić’s that has the same name and which Sumant was reviewing. The blog post talks about sum types and pattern matching, comparing such modeling alternatives as inheritance and std::variant. The main differences are then later collected in a table. There is also a part dedicated to immutability with
propagate_const, and a discussion on mutable temporaries and Named Parameter Idiom.
STL in legacy code
These last few months Jonathan Boccara celebrates 1 year of his Fluent C++ blog. We sincerely congratulate Jonathan and thank him for the extremely valuable content that we are always happy to read. The article we’d like to mention here today is “How to Use the STL With Legacy Output Collections”. It’s a situation we can all find ourselves in, and it can be really painful. The blog post presents a way to create a generalized component that can output into anything and actually solves the problem.
Writing a type predicate
Can you easily suggest a meta-function to check that a given type T has some particular nested type, a particular static member function, and a particular member function with the defined return type and some extra conditions? Andrzej Krzemieński in his blog builds a solution. He also experiments with the result and suggests several variants: one using Concepts Lite, one using Tick library, and one using range-v3. The latter can be tested online in Wandbox – link to the prepared sample is provided in the blog post.
Visualizing a sort
Most of us have learned at least a couple of sorting algorithms. How about seeing them in action? Here you can do that! Select from Bubble, Cocktail, Gnome, Heap, Insertion and other sorts, set size and shuffle and enjoy the animation. And by the way, the most interesting thing is when you turn on your computer’s sound, because this interactive visualization includes sound!
A story about weak pointers
Bartlomiej Filipek in his blog tells a story about
weak_ptr preventing memory from being cleaned. The situation when a big chunk of memory that is managed by several
shared_ptr and one
weak_ptr, is not released in some cases until a weak pointer is also ‘dead’, is unwanted and could be quite a surprise for a developer. Mind, that’s not about calling a destructor, but about freeing the allocated memory. In the article, you can find a sample to reproduce the case, along with the description of how memory is allocated in this case and the explanation why the problem happens.
Godbolting your C++ code
We were so inspired by Matt’s keynotes at CppCon that we immediately asked him if he would let us interview him for CLion’s blog, as we really wanted to chat more on the topic. We asked Matt what he thinks about “massive Godbolting of the code”, discussed why reading Assembly code can be beneficial for everyone’s development process, and even asked Matt to share the trickiest piece of C++ code he had ever met. Want to see his answer? Check the interview.
C++17 is Here
In this interview to InfoQ Herb Sutter talks about his feelings on the newest C++17 standard and the major focus for C++20 as it’s now set in the committee (you can easily guess here – Concepts, Concurrency, Library Fundamentals, Ranges, Coroutines and Networking). In this interview Herb also talks about other languages and the inspiration they have given, mentioning Swift as a great experiment.
Towards a more powerful and simpler C++
This is another interview with Herb Sutter, done by our team soon after the CppCon had finished. Here we tried to get a better idea of metaclasses, learning how it was born, what references were taken into account, and how the proposal is going to evolve in the future (and what are the estimations for this in the future). Herb also talked about the committee’s reaction to the proposal at the summer meeting and the implementations in the compilers, as well as his proposal for the three-way comparison operator and support for the new language features (including metaclasses) in the tools.
CLion 2017.3 was released in the last week of November. The team tried to accomplish both missions at one time – improve C++ support in some core areas like list initialization and name lookup, and introduce new integrations like Valgrind Memcheck and Boost.Test and a couple of other new features. It seems we managed to accomplish what we set out to do, but really it’s for our users to decide – a free evaluation is available from our site. A detailed blog post also includes a video from Phil Nash, a developer advocate in JetBrains and an author of the Catch framework, as well as a link to the test demo project which you can use to try out the new features and improvements.
CLion’s plans for 2018 in general and 2018.1 in particular are available now in the blog as well.
ReSharper C++ 2017.3 was released in December. It improves the debugging experience by adding inline watches for various values to the editor (like local variables, function parameters, current line expressions and function return values) and integrates with the Clang-Tidy code analysis tool. As for C++ understanding, ReSharper C++ 2017.3 brings support for structured binding declarations, inline variables, constexpr if statements, and return type deduction for functions with auto return type and lambdas.
KDevelop 5.2 was also released in November. It ships with Heaptrack (a heap memory profiler for C/C++ on Linux) and cppcheck (static analyzer for C++) analyzer plugins come out of the box, it stabilizes the clang-based C++ language engine and brings dozens of changes to PHP and Python support.
LLVM 5.0.0 was released in September. Some notable changes for interested C++ developers include a new CMake macro LLVM_REVERSE_ITERATION (when enabled all supported unordered LLVM containers are iterated in reverse order), changes to C API, LLVM IR and many other additions. As for Clang 5.0.0, the biggest feature is probably that C++ coroutines are now supported!
Subscribe to Blog updates
CLion Nova – Final Update
CLion Nova is a free preview version of CLion equipped with the ReSharper C++/Rider C++ language engine. We started it as a stand-alone preview in November 2023, and since then we’ve received tons of positive and inspiring feedback. Based on that feedback, we’ve added a setting to the recent CLion C…
CLion 2024.1 EAP 4: Switch to CLion Nova in CLion Classic
The CLion 2024.1 EAP 4 build (241.13688.39) is out! It is available from our website, via the Toolbox App, or as a snap package if you’re using Ubuntu. With this build, we’re making CLion Nova available to all CLion Classic users. Switch to it from inside the IDE via the settings menu and try it …
CLion 2024.1 EAP 3: Assembly View Enhancements
Today, the CLion 2024.1 EAP 3 build (241.12662.59) is available from our website, via the Toolbox App, or as a snap package if you’re using Ubuntu. Here are the main improvements: Assembly view improvements: The Assembly view for ARM targets is now shown correctly (CPP-36901). Assembly vi…
CLion 2024.1 EAP 2: Improved Terminal and Other UX Enhancements
Some time ago, we shared our plans and directions. Just a couple of weeks ago, we kicked off our CLion 2024.1 EAP with CMake coding assistance, code analysis in device tree files, and forked processes debugging. Today, the CLion 2024.1 EAP 2 build (241.11761.23) is available from our website, via…