Exceptions Explained Part 4: C++

After quite the lengthy tread through GCC and C-land (mind you everything discussed before was written in C), we finally find ourselves back at C++. C++ exception semantics seem simple, but actually hide many surprising edge cases. Functions Like before, let’s discuss the API of the C++ exception handling regime. Note that while you’re not supposed to call these functions directly, these functions are called in compiler generated code anyways, so are a part of the public ABI....

2025-01-15 · Shin Umeda

Exceptions Explained Part 1: Architecture

As it turns out there’s not really a good in depth explanation of how exceptions work. There are disparate explanations of how separate parts of exceptions in C++ work, but not really the whole picture. So I’m writing this down here as a reference to how everything in C++ exceptions work. Disclaimer My experiences are exclusively in GCC. Broadly, Clang should follow the same Architecture as GCC, but may vary in implementation details....

2025-01-13 · Shin Umeda

Modifying GCC

Quite a while ago, I’ve integrated my exceptions work into a fork of GCC. At that point, I was already modifying GCC to suppress the libunwind symbols, so putting all of my code into GCC was a no brainer. Moreover, it isn’t actually that hard to build GCC. Editing GCC GCC is built via the autoconf build system. Autoconf is a collection of scripts that is somewhat like CMake, but written entirely in shell script and is intended to be portable for any system that runs shell scripts and has a C compiler....

2024-11-10 · Shin Umeda

Exceptions

For the past couple months, I’ve been trying to get exceptions to work on AVR as a hobby project. After several months of work, I’ve done it. Exceptions work, you can just include <vector> and it just works. How to use it Currently I put prebuilt toolchains on github. My changes are currently a bunch of patches to gcc 13.2.0, binutils, and a few others. What I actually did I’ve reimplemented libunwind, the personality function, and also cfi macros by replacing them with my own stuff....

2024-06-03 · Shin Umeda

Bitstruct

I was looking at I2C code, and noted that there was an awful lot of manual bit manipulation. Unfortunately the native solution in c++, bitfields, are non-portable and for that reason is discouraged in code bases. For that reason, I have written a library called bitstructs, which aims to do what bitfields do but portably. What are bitfields Bitfields are a bit of an obscure feature in C++, aimed at embedded developers....

2023-12-24 · Shin Umeda