Open in app

Sign in

Write

Sign in

CMP
CMP

46 Followers

Home

About

Nov 20

Improved String Handling In C++20

Many C++ programmers are familiar with the basics of the <string> library, particularly the use of std::string when creating a string in C++. This is definitely an improvement over the old C-style “strings” using null-terminated char arrays. However, the C++ standard libray has introduced more useful components in C++17 and…

Cplusplus

3 min read

Cplusplus

3 min read


Nov 8

C++20 Concurrency: <stop_token>

A simple way to handle cancellation of asynchronous tasks — In a previous article, I talked about using std::jthread as a simpler and safer way to create multi-threaded C++ programs using C++20. However, I did not discuss the benefits of using the C++20 <stop_token> library header alongside std::jthread for simple cancellation of coroutines and asynchronous tasks. What is the <stop_token>…

Cpp

3 min read

Cpp

3 min read


Oct 26

Complex Logging and Debugging in C++

Common tools and new C++20 features — When developing complex C++ programs, you will often run into complex issues that are difficult to debug just by looking at the source code. This article introduces various logging and debugging tools and strategies that can be used to analyze these complex bugs. Debugging Tools Debugging is hard. It is…

Cplusplus

4 min read

Cplusplus

4 min read


Sep 25

C++20 Concurrency: <semaphore>

An efficient mechanism for managing access to a limited resource — In one of my previous articles, I discussed a few locking mechanisms that provide mutual exclusion — a synchronization concept where exclusive access to a single shared resource is provided to exactly one thread at a time. …

Cpp

4 min read

Cpp

4 min read


Sep 15

const vs constexpr in C++

Both const and constexpr are keywords used to specify that a value cannot be modified, but they have some differences in functionality and use cases. What is const? const is a fundamental keyword in C++ used for defining constant variables, meaning the value of the variable cannot change. Look at…

Cpp

4 min read

Cpp

4 min read


Sep 8

Endianness in C++20

A portable way to check for system endianness in C++ — Endianness Basics The endianness of a system refers to the order in which bytes are stored in memory or transmitted over a network. Big-Endian systems store the Most Significant Byte (MSB) at the lowest memory address. This is used in various network protocols to send data over a network, also…

Cpp

2 min read

Cpp

2 min read


Aug 28

Introduction to the C++20 spaceship operator

C++20 introduced the three-way comparison operator, also known as the “spaceship operator” due to its appearance: <=>. The purpose is to streamline the process of comparing objects. The Basics Below is a simple example that uses this new spaceship operator: #include <compare> int main() { int a = 1…

Cpp

7 min read

Cpp

7 min read


Aug 21

Mastering memory efficiency with std::span

A useful C++20 tool for providing a non-owning view of contiguous memory — Before diving into the usage of std::span, it is important to understand the concept of ownership of resources. When a container such as a std::vector is created, the container has ownership of the memory used to store data inside of it, meaning that it is the responsibility of the container…

Cplusplus

6 min read

Cplusplus

6 min read


Aug 1

Modern C++ memory allocation

Memory allocation is an important concept for systems programmers to understand, especially when working in environments where resources are limited. This article will go over the differences between the different types of memory allocation and the best practices in modern C++. Static vs. Dynamic vs. Automatic Memory Allocation When learning…

Cpp

8 min read

Cpp

8 min read


Jun 20

C++20 Concurrency: std::barrier

A reusable alternative to std::latch — I previously wrote about using std::latch to synchronize multiple threads. While that is a great mechanism for simple one-time synchronization scenarios where multiple threads need to meet at a synchronization point before continuing execution, it is less flexible than the other new C++20 concurrency primitive: std::barrier. What is std::barrier? Like…

Cpp

2 min read

Cpp

2 min read

CMP

CMP

46 Followers
Following
  • Šimon Tóth

    Šimon Tóth

  • Andrey Karpov

    Andrey Karpov

  • Isaac Berrios

    Isaac Berrios

  • Elysium Celeste

    Elysium Celeste

  • Nelson Seixas

    Nelson Seixas

See all (24)

Help

Status

About

Careers

Blog

Privacy

Terms

Text to speech

Teams