At the core of an interpreter is a loop that iterates over instructions and executes them in order. This requires dispatching: based on the current instruction it needs to select different code. A fast interpreter requires a fast instruction dispatcher, but so does everything …
C++ and Rust are both system programming languages that recently received support for asynchronous programming using coroutines. Given the memory and time constraints, both languages opted for stackless coroutines implemented by a compiler-generated state machine. However, beyond …
Global variables are initialized before main()
runs, but the relative initialization order is not necessarily well-defined.
As such, accessing global state while you initialize your global variables, might not work the way you expect.
A simple solution is to stop using global …
C++20 adds the “spaceship operator” <=> for three-way comparison, fundamentally changing the way we implement comparison. But there are a lot more changes: Comparison categories will give more structure, and the new operator rewriting rules will massively reduce …
When you need a container, pick std::vector<T>
by default. This is common advice.
Why? Because std::vector<T>
is cache-friendly.
This talk will quickly explain what it means, why it is so important, and how to write cache-friendly code yourself. We will look at the …
“Do not use owning raw pointers, use a smart pointer instead.” — And yet it is common to use them when writing a linked list, for example.
“Use a reference when a pointer is non-null.” — But the standard library interfaces themselves don’t follow …
Every non-trivial programming language needs a way to refer to another object that is stored in a different place. In some programming languages this behavior is the default — they have reference semantics.
But this is not the case in C++. In C++ you need a special type to refer …
C++11 added a generalized attribute syntax to annotate your code with additional information - basically comments that your compiler will read. It also standardized a couple of attributes. C++14 and 17 went on to add more standardized attributes. But C++17 also added another …
C++ provides a really advanced type system. A prime example of its application is std::chrono: It uses the type system to create different types for different units and prevent programmer errors.
But the same principle can be applied to your everyday code - this talk is going to …
Judging by the recent amount of talks about the STL Allocator model it is a pretty well-known fact that is has some issues. This is a problem because allocators are essential for many performance demanding applications such as games. The STL model makes it awkward both to write …