Assembly Optimizations I: (Un)Packing Structures

This is the first post in a series about optimizations that can be performed when compiling C (or possibly other languages) to x86_64 that are currently not performed by popular compilers (Clang/LLVM, GCC/GNU, ICC/Intel). While some of these may be relatively straightforward, others may require a…

Solving the strcat() Woes

In C, the common and canonical way to concatenate strings at runtime is to use strcat(). For most cases, this works perfectly fine - here's a simple example: const char *intro = "Hi "; const size_t len = strlen (intro) + strlen (name); char *greet = malloc (len + 1); if (!greet) { // handle error } strcpy…