Modern C++ and Native Code (converting from bfilipek.com)
Two weeks ago, 20th May, I had a pleasure to talk about filtering elements on our Cracow C++ User Group online meeting.
Here are the slides and additional comments from the presentation.
Finally Restarted After a few months of break, we finally restarted our Cracow’s C++ group!
Thus far we had two presentations in 2021:
C++ Software Security Sins In the world of software development, we are up against new cybersecurity threats each day, and the risks and consequences of un-secure software are too significant to be unaware of.
Let’s review some common security threats that might lurk in our C/C++ code.
This article is an adapted version of the presentation given by Mary Kelly, supported by Embarcadero.
Before you start implementing your custom concepts, it’s good to review some goodies in the Standard Library. There’s a high chance that there’s already a predefined concept for you.
Today let’s have a look at concepts related to callable objects.
Where to find them You can find most of the predefined concepts in the <concepts> header.
According to the recent popular paper “There is plenty of room at the top”1, SW tuning will be one of the key drivers for performance gains in the near future. The growth of a single-threaded performance of modern HW is slowing down, that’s why SW tuning will become more important than it has been for the last 40 years.
Concepts are a revolutionary approach for writing templates! They allow you to put constraints on template parameters that improve the readability of code, speed up compilation time, and give better error messages.
Read on and learn how to use them in your code!
What is a concept? In short, a concept is a set of constraints on template parameters evaluated at compile time.
Before C++17, we had a few quite ugly-looking ways to write static if (if that works at compile time). For example, you could use tag dispatching or SFINAE. Fortunately, that’s changed, and we can now benefit from if constexpr and Concepts!
Let’s see how we can use it and replace some std::enable_if code.
Between 2018 and 2020, I released several articles with top 5 proposals just around a new ISO C++ meeting happened. Since March 2020, this pattern broke as the meeting went online. Why not restart the series? :) We can look at the recent papers from a whole Quarter.
When you create a model for your domain, C++ offers you flexibility and increates type-safety with so-called Strong Types. Rather than working with simple built-in types, you can create a set of well-defined classes that better suits your needs. In a new blog post, you can see one concrete example of such a design practice.
constexpr has become a major feature for compile-time programming in C++. Introduced in a simple form in C++11 evolved into almost another “sub-language”, an alternative to regular template code. In C++20 you can even use std::vector and std::string in constexpr context!
In this article, I’d like to discuss constexpr memory allocations, a building block for std::vector.
Currently, as of C++20, there’s no support for so called non-terminal variadic arguments. For example, we cannot write:
template <class ...Args> void func(Args&& ...args, int num=42); func(10, 20); // error As you can see, I wanted 10 and 20 to be passed as ...args and 42 as a default value for num.
No matter how proficient you are, I think, you might still use one of the primary methods of debugging: trace values using printf, TRACE, outputDebugString, etc… and then scan the output while debugging.
Adding information about the line number and the file where the log message comes from is a very efficient method that might save you a lot of time.
Thanks to lots of CPU cores available even in basic computer system we can significantly speed up compilation our projects. In a new article, you can look at techniques and experiments with building things faster in C++ Builder and a well-known free IDE DevC++.
This is an adapted guest post by Eli M and supported by Embarcadero.