Hi, I'm Tomasz
I'm a professional C++ software engineer with over a decade of hands on development experience with variety of technologies (mostly Linux & embedded systems). This is my blog.
Find me on social media
Work on c++23 standardisation is well in progress and we already have a couple of new features to play with. Toolchain support varies but some early testing is already possible. I’ve prepared a list of features that I, personally appreciate a lot and which most definitely will improve my code. Let’s go through them.
CppCon overview There’s a set of great CppCon talks regarding new additions coming with c++23. Amongst others, a nice, concise and to the point overview is probably best presented by Marc Gregoire.
Intro I started using meson exclusively for any new C or C++ project I create. It’s much more convenient and less cumbersome than CMake. In this post, I’ll try to give a short introduction to meson and the reasons I like it.
My typical meson project layout My projects usually contain small libraries with a set of tests or executables relying on a bunch of libraries. For the purpose of presentation, I’ll start with a demo project, let’s call it libmagick.
Functional parsing and parser combinators Recently, on my routine round through YouTube and social media, I’ve came across a video from Ashley Jeffs regarding a message broker he’s the author of called Benthos. Benthos itself is very interesting and I recommend to learn more about it, but what especially caught my interest was a different video from Ashley, regarding bloblang - a configuration language for Benthos written using parser combinators. Frankly, this was the first time I’ve heard that term and, intriguing as it sounds, I wanted to learn all about it.
In this post I’ll try to clarify some of the misconceptions about C++ which I often find in various code bases.
People have their habits C++ is a complex language. Part of this complexity stems from legacy. With legacy comes source code which is often bad. Code that is difficult to maintain, which relies on false assumptions. These assumptions have been reinforced in programmers’ minds early on when the language was in its peak popularity (which was probably like 20 years ago) or (even worse) have been adopted from C world by people who still think that C++ is just C with classes.
/proc provides essential data about the operating system on which the program is running. Often there’s a need as well to alter system’s configuration using /proc files as an interface. Now, you may ask yourself, why should you care? After all, there are already well established solutions like i.e. procfs or containerd allowing for convenient dealing with proc files, cgroups… and I agree. Sometimes though you just don’t want to suck in a huge dependency like containerd and it’s much easier to write something smaller that is better tailored to specifics of the problem at hand.
What are method expressions? Coming from a C++ background, I’ll allow myself to use a C++ example. If you know C++, Golang’s method expressions are very similar to member pointers. The code is relatively simple and even if you’re not a C++ enthusiast it should be possible to understand the intentions
Here’s a short C++ recap:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 class Foo { public: std::string foo() { return "foo"; } int bar(int i) { return i; } }; using FooPtr = std::string (Foo::*)(); using BarPtr = int(Foo::*)(int); int main(int argc, const char *argv[]) { Foo f{}; FooPtr fooPtr = &Foo::foo; BarPtr barPtr = &Foo::bar; std::cout << (f.
Why? Well, it kind of happened by accident, if I’m honest. While working on a different project, where I’m building a set of utilities (assembler, disassembler, debugger, simulator) for a custom programming language, I needed a parser to create some basic CLI interfaces. I wanted to limit the amount of dependencies and thus didn’t want to reach for Boost’s program_options. Another reason is that I don’t really like it that much.