In the last article, I explained the different value categories. In this article, I'll elaborate on the C++ move semantics. Let's review this code: #include <iostream> #include <string> class DataStructure { public: DataStructure (uint64_t size) : m_size(size), m_data(new uint64_t[m_size]) { print("ctor"); } ~DataStructure () { print("dtor"); if (m_data) { delete[] m_data; m_data = nullptr; }… Continue reading I Like To Move It Move It
Category: C++ quirks
Value Categories In C++
In C++, every expression has a value category. In C++03 (and before), we had two value categories: lvaluervalue In C++11 (and later), we were introduced with new categories: lvaluervalue - prvalue or xvaluexvalueglvalue - lvalue or xvalueprvalue - C++03 rvalue In this article, I'll explain the categories and in the next article, I'll elaborate on… Continue reading Value Categories In C++
C++ Standard Attributes
Back in 2011, C++ got new features. One of them is attributes. This feature lets the software developer the option to provide the compiler some additional information regarding the code, so it would compile/optimize the code in a specific way. In this post, I'll elaborate on some of the available standard attributes in C++, when… Continue reading C++ Standard Attributes
Buffer Overflow Detected
Lately, I've worked on an interesting bug. A little overview: We have a binary process that is responsible for distributing video and audio to other machines. We support distributing a maximum of 4 audio streams. Each audio stream consists of two audio channels (left and right). The bug: when we distribute video and 4 audio… Continue reading Buffer Overflow Detected