Logo

Blog


C++ Insights updates

Last week, I pushed an update to the web-part of C++ Insights. I kinda felt like a web-developer for some time. I now know, that there is CSS grid layouts which seems the superior of flexbox layout. I more of less stumbled over this while looking to solve a problem which bothered me for a long time and was also reported as an issue from some of you, the missing ability to resize the input and output panels as well as hiding the console. I know that there are frameworks out there which are able to handle things like this. However, I have the goal for the web-part that it should be simple and save resources. On the server side as well as on your computer. In general, I like it, when I can solve things in pure HTML5 and CSS3 (wow even more web-dev-slang :-). CodeMirror brings Javascript so a bit more is not that bad. Well, all the frameworks I looked into or tried did not make me happy. Two or three weeks ago, while doing something completely different, I stumbled over CSS grid layouts which seemed to make resizing much more feasible. In fact, they also allow better arrangements of the panels. After some fights with CSS3 grids and a few mistakes on my side I had a version which now is able to resize the panels. In theory, there should now be also a decent mobile layout. However, for some reason on my iPhone the input and output panels are still side-by-side. If it happens to work on your phone, please let me know. The same goes, in case you experience other issues. Keep in mind, despite all the buzz-words above I remain a C++ developer and trainer :-)

Quick Bench button

This is a mixture between C++ and HTML, there is now a Quick Bench button. Fred told me that he will be working on C++ Insights support for Quick Bench when he finds the time for it. To make this available in C++ Insights the Docker container now ships with the Google Benchmark headers. This could also be a good example of how to include other headers as for example requested here.

Turn the lights off

Some of you prefer to work with a dark theme. There is (web-dev knowledge again) support for switching the theme based on your operating system settings. C++ Insights now supports this as well as letting you set the dark theme as a default. There is a new settings page where you can adjust your preferred defaults. Here you can also grant or revoke cookie permissions.

Back to C++

Now, lets move to C++. Clang 10 is out since 24th March. On the 1st April I received a PR Fixes cppinsights build with Clang-10 and no it was not an April Fool's trick. The PR aimed to make C++ Insights build with Clang 10. There are many great things in that PR. Someone cared enough to look into it and not just fixed it on their local machine, no it was also raised publicly. Thank you, Ameya Vikram Singh for that. It also showed me two other things. First people are building C++ Insights locally. Second, they are interested in building it with the most recent version of Clang! Amazing. This made me look into the GitHub statistics. From 22. March to 4. April there were 34 clones, 27 of them are counted as unique. In the same frame the repo had 243 views of which 145 are counted as unique. Probably not as many as Matt has but motivational enough for me. While we are on statistics, the website has around 1.000 invocations a day. This is the number of times a transformation is done, the number of visitor may be higher but is not tracked.

Clang 10 is there, and with it more C++20

Ok, Clang 10 is out and with that LLVM 10. The release notes of LLVM lists a lot of changes. The C++ support status of Clang 10 is also impressive. As you can see here they are doing pretty good on the C++20 features. There is already good support for Concepts. As far as I know, most of the heavy lifting there was done by Saar Raz. He gave at least two talks about this, one at Core C++ 2019 and another one at CppCon 2019. I attended the first one and can recommend watching it, it was pretty fun and informative for me. Clang 10 has also good support for Coroutines, where Gor Nishanov did a pretty good and long-running job to get them into the C++ Standard. There is support for consistent comparisons, lambda improvements and a lot more.

Back to C++ Insights. Some of these new features will just work, others require some patches to C++ Insights. I'm already having a patch for consistent comparisons which needs some additional tests. I briefly looked into Concepts. They require some more work, I have only a rudimentary patch for them so far. I plan another post for a more detailed discussion on how to visualize Concepts. If you already have an idea how you would like to see them, please feel free to contact me (via mail or on Twitter).

Windows support

Sadly, during the upgrade to Clang 10 the Windows build failed. Even after multiple tries to get it working it still failed. As I'm not familiar with this world and I do the "debugging" only via Appveyor I decided to abandon the Windows build for now. I plan to bring it back. If you happen to use Windows for your C++ Insights builds, you may be able to assist me here.

Slowly updating C++ Insights

The change to Clang 10 has more impact than the once in the past. This is time there are more major features of C++20 supported. The CI pipeline uses Clang as well as GCC to build and test. In the past I only rarely lifted GCC to a new major version. With the raise of Concepts and Coroutines GCC 8 which is currently used will no longer be sufficient. I live by the principle to change only one thing at a time to see whether it works. For that, I first pushed a C++ Insights version which works with Clang 10. In the next couple of days I plan to switch the GCC version to 10. If all that is working and stable I will start adding support for new C++20 features. So stay tuned for this!

More C++ Insights

I'm pleased to announce that I will start a project I had in mind for a long time: Short C++ Insights video clips on Youtube. The idea is to talk about how you can use C++ Insights and where it can be helpful in teaching or even bug understanding. I will also talk about internal things of C++ Insights. In case, you have a specific item you want to be covered, feel free to reach out to me. The initial plan was to release a 5 to 10 minutes clip each month. As I currently have a bit more time, I plan to release at least the first four clips in a weekly manner.

Update 2020-05-13: And here it is

Support the project

Have fun with C++ Insights. You can support the project by becoming a Patreaon or of course with code contributions.

Andreas