C++C++14C++17C++20Learn C++

Learn To Use Digit Separators In Modern C++

In the history of modern C++, the C++14 standard brings us some very useful features. C++14 comes with the digit seperators feature. In C++14 and above, we can use the digit separator  to separate integer numbers. In this post, we explain, how to use digit separators in examples, How can I use use digit separators in modern C++? In C++14, there is a new Digit Separators feature. The digit…
Read more
C++C++11C++14C++17C++20Learn C++

How to Use Atomic_flag In Modern C++?

C++11 allows the use of atomics in signal handlers. In C++17 the signal handler feature is further improved. The std::atomic_flag is an atomic boolean type that is guaranteed to be lock-free and can be used in signal handlers. Moreover, the <csignal> header in C++ has an integer type std::sig_atomic_t that can be accessed as an atomic entity even in the presence of asynchronous…
Read more
C++C++11C++14C++17C++20Learn C++Syntax

What Is Weak Compare and Exchange In Modern C++?

Since the C++11 standard, the Concurrency Support Library includes built-in support for threads (std::thread) with atomic operations (std::atomic). C++11 provides both weak and strong compare-and-exchange operations in multi-threading applications. Since C++11, weak compare and exchange are used in modern C++ standards such as C++14, C++17, C++20, and in other new standards. In this post, we…
Read more
C++C++11C++14C++17C++20Learn C++Syntax

What Is A Data Race In Multi-threading C++ Apps And How To Avoid It

In modern programming, if you are developing multithreaded applications, data races are a common problem in threads. Data races occur when multiple tasks or threads access a shared resource without sufficient protection, leading to undefined or unpredictable behavior on runtime. You can imagine two or more task threads in cores trying to reach the same data in a race. In this post, we explain…
Read more