Diving into the C and C++ Standard Libraries

Please log in to access your purchased courses.

All of us rely on the standard library whenever we are writing a C or C++ program. However, most of the time we don’t actually get to see what’s happening under the hood.

When we started writing and maintaining our own libc implementation, we were quite surprised to see just how old and low quality some of the commonly used libc function implementations were. Over the years, we’ve been working on modernizing some of this code. We also encountered and solved a number of interesting programming and compilation challenges as a result of getting our libc to work on a variety of systems.

Once we started using C++, we expanded into maintaining our own libcpp implementation, which is a slightly modified version of the LLVM C++ and C++abi libraries. This implementation is designed to work with our libc and to support microcontroller usage.

This members-only course is meant to serve as a compendium of interesting lessons learned from writing and maintaining C and C++ standard libraries. We will also be featuring implementation analyses, refactoring demonstrations, and tooling integrations as we continue to maintain and improve the library.

Building the C Standard Library

These lessons are related to the process of building the standard library.

Lessons

Problems Caused by _Nonnull Optimizations When Compiling with GCC

Program Startup

Under the Hood: Implementation Details

These lessons relate to C and C++ standard library and language implementation details that are typically hidden from normal users.

Lessons

Linker-Generated Variables in Libc Preview Compiler-Generated Deleting Destructors in C++ What is __cxa_unexpected_handler()?

Testing and Debugging

These lessons document test strategies, as well as debugging efforts that are related to test failures and user-reported failures.

Lessons

Converting Floating Point Epsilon Comparisons to ULP Comparisons Fixing Floating-Point Bugs in gdtoa