In a previous blog we demonstrated the most straightforward method to optimize Visual Studio Code for a Qt / C++ environment: simply let the tools do all the work! The example GitHub project we discussed automatically installs both the Microsoft C/C++ and clangd extensions into VS Code. You might wonder why you need both C++ […]
Today’s blog post is about a small utility class in Qt with a… questionable name: QPointer. If you’re new to Qt, maybe don’t check out QPointer’s documentation just yet, and try to guess what the class does based on its name alone. I’ve seen countless users being very confused by it. Some end up using […]
When writing large graphics applications in Vulkan or OpenGL, there’s many data structures that need to be passed from the CPU to the GPU and vice versa. There are subtle differences in alignment, padding and so on between C++ and GLSL to keep track of as well. I’m going to cover a tool I wrote […]
Last time we touched upon object lifetime and today we wrap up the basics with a bit of a spicy topic of object ownership. We covered the lifetime quirks, and we found out that manual memory management can be a nightmare, even if we new and delete in the correct order. There must be something […]
Last time we discussed Value Semantics. However, I missed one topic that is super important for a better understanding of basic building blocks of C++. Today, we are going to talk about an object. Without further ado, let’s dive deeper! Object What is an object? According to the C++ standard, part 3.9.8 under the name […]
C++ is an old language. Many aspects of our programming styles have become habits that we do not think about too much today. In this blog, I’m going to address one major issue that has resulted from such habits and get you prepared for a new bright world of C++2b. So without further ado, let’s […]
If you have bought an AAA game in recent years and wondered what it is doing when it says it is compiling shaders for a long time (up to an hour or more), then this blog will explain it a little.
The familiar solution for thick value classes that want to preserve binary compatibility is to use the pimpl pattern (private implementation), also known as d-pointer (pointer to data). In future versions of our class, we can freely change the contents of the pimpl (i.e. adding, removing, and/or modifying data members) but the binary compatibility of […]
Floating-point math is hard, and compilers will exploit every language loophole to make our FP calculations go faster, sometimes with surprising results.
A very common implementation pattern for QObject subclasses is to declare its child QObjects as data members of type “pointer to child.” Raise your hand No, keep your hand on your computer input device 🙂 Nod if you have ever seen code like this (and maybe even written code like this yourself): A fairly common […]