When Bash starts, it loads a bunch of startup scripts to configure itself. You know, ~/.bashrc and friends. Which scripts are executed in what order is complicated. It depends on the type of the shell, the mode it’s in, how it was compiled, and what code each Linux distribution puts into the default startup scripts. The type of shell has two components: An interactive shell is what most people think of as the command line. It shows a prompt, waits for keyboard input and prints output to a s...| Here Be Braces
Windows is a hard environment for a C++ developer to live in – at least if you don’t use Visual Studio. What I find most annoying is setting up and maintaining several compiler toolchains in parallel. Compiler distributions – above all MinGW-w64 – are pretty much one-click installations these days, but easily switching the environment between different toolchains and moving those toolchains between computers ist still a hassle. Since I’m lazy, I started scripting. :-) Now I have a m...| Here Be Braces
I can never remember were to find the documentation for a particular compiler version. So here is a cheat sheet.| Here Be Braces
Seriously! Sharing memory between processes is a tricky beast as it is. Add C++ objects into the mix and things turn from tricky to unreasonable. As attractive as it sounds to share a bunch of objects in a virtually zero-copy, instant-update way, as hard it is to avoid producing a barely working, bug ridden, unmaintainable mess. …| Here Be Braces
Three and a half years ago I wrote down my personal C++ Coding Guide. My programming style has changed a bit since then, and it’s time for an update of the original article. This is the changelog: The clang-format style definition was created for … not sure exactly. Clang 6? I updated it for Clang 15. Nothing substantial changed. The name of the private namespace changed from detail to private_. On the one hand detail is extremely common in the Standard adjacent community. On the other ha...| Here Be Braces
The open-closed principle needs no introduction. It’s a part of SOLID, it’s a valuable design tool, mountains of text have been written about it. To recap: The principle says to make your software open for extension, but closed for modification. Once you decide that following that principle is valuable for a component of your software, how do you implement it? Immediately everybody thinks of a polymorphic class hierarchy. After all, that’s the example used in virtually every article on ...| Here Be Braces
Question: Is this a copy constructor? Don’t look it up! T::T(T& other, int i = 0); I thought I knew this! It has two parameters and the first one isn’t const. This is not a copy constructor. To my surprise C++ disagrees. I should have expected something like this, though. In C++ everything is more subtle than it looks. Of course the next question was: What exactly does count as a default/copy/move constructor, copy/move assigment operator or destructor? The C++ standard calls this group o...| Here Be Braces
In my job I’m currently dealing with writing coding guides for several languages. That prompted me to sit down to do something I’ve been thinking about for quite a while: Compiling my personally preferred way of writing C++ into my very own coding guide – a.k.a. this article. The guide was written in 2019 and updated in 2023. See the changelog for details. As I see it a coding guide consists of two parts: The style guide contains rules and guidelines about formatting and naming. This pa...| Here Be Braces
The implementation of my unicode_algorithm library had barely started when I encountered a problem I had not considered at all. Unicode code points have a lot of properties for things like the character type, uppercase/lowercase mappings, bidirectional mirroring, and so on. The data is freely available and it would be easy to simply dump it into an array indexed by code point number (in the following called the naive array). However, code points have a valid range of 0x0 to 0x10FFFF for a tot...| Here Be Braces
While researching and brainstorming for a completely unrelated project idea I decided to attempt to write a Unicode library for std::string, the canonical string type in C++. This post is about why I made the decision and it develops a first draft for how such a library could be designed. …| Here Be Braces
CMake has come a long way since the 2.x dark ages. But even in the newest versions some things can still feel confusing and rather convoluted. Installing is one of them. It’s relatively straight forward for applications meant for end users. However libraries that are supposed to be used as dependencies by other developers from other projects, those are a different story. This article is about exactly that: installing a library with everything required that other CMake projects can make conv...| Here Be Braces
This article is a bit of an experiment. It describes my thought process while developing a small C++ feature, including failed attempts and all. Of course it’s cleaned up somewhat. The unedited reality would be a bit too messy to make a coherent article. So … Let’s talk about enums in C++. They are a helpful, easy to use little feature in the language, especially since enum classes added more type safety and scoped names back in C++11. For the rest of the article I’ll use the followin...| Here Be Braces
There’s a problem with CMake and code generators that keeps coming up from time to time. I’m talking about the kind of code generators where you know their list of output files only after they are done executing. The generally agreed upon rumour at my place of work and on the web is that integrating such a generator into CMake is a huge pain. It turns out, the rumour isn’t quite accurate. And here’s why. …| Here Be Braces
LLVM 3.9.1 was just released. It’s time to build the new LLVM/Clang with MinGW. I managed to build the following things successfully: LLVM: the base for everything else Clang: C++ and C compilers, libClang, clang-format Clang Tools Extra: mostly because it contains clang-tidy LLD: the LLVM linker; haven’t played around with it yet, but it builds ;-) These do not build, even after some coercion: OpenMP: generally supports Windows, but not MinGW libc++: from what I could gather from the doc...| Here Be Braces
Building Qt is a bit of a hobby of mine. Not that I have a choice. MinGW 64bit is clearly not a first-class platform for the Qt developers. No official binary exists and most of the time Qt will only build after applying a patch or two. That’s why I built Qt 5.6.2 only now, even though it was released about two months ago. I always try to build as much of Qt as possible, even though I only really need a relatively small subset. Two components are missing: No Qt WebEngine module. It’s buil...| Here Be Braces