Mon 01 May 2023

My favorite C compiler flags during development

The major compilers have an enormous number of knobs. Most are highly specialized, but others are generally useful even if uncommon. For warnings, the venerable -Wall -Wextra is a good start, but circumstances improve by tweaking this warning set. This article covers high-hitting development-time options in GCC, Clang, and MSVC that ought to get more consideration.

There’s an irony that the more you use these options, the less useful they become. Given a reasonable workflow, they are a harsh mistress in a fast, tight feedback loop quickly breaking the habits that cause warnings and errors. It’s a kind of self-improvement, where eventually most findings will be false positives. With heuristics internalized, you will be able spot the same issues just reading code — a handy skill during code review.

Source: My favorite C compiler flags during development, an article by Chris Wellons.

Algebra and Data Types

In math class you’ve done algebra, with addition and multiplication and exponentiation and polynomials like 1 + x + x². And while programming, you’ve worked with enums and structs and functions and lists. You probably thought these things were unrelated.

Surprise! They’re deeply related, and by the end of this post you’ll see how to use algebra to refactor your data types. The crowning example in this post will be finding an equivalent representation of red-black trees.

Source: Algebra and Data Types, an article by Justin Pombrio.

Move Over, Dockerfiles! The New Way to Craft Containers

Docker has become an immensely popular tool in the world of software development, and for good reason. It provides an excellent way to create, manage, and deploy containers, which in turn enables developers to run applications that work the same way in development and production. However, creating Docker images can sometimes be a pain, as anybody who has accidentally broken the apt cache and triggered an hours-long build by making a minor change can tell you.

Source: Move Over, Dockerfiles! The New Way to Craft Containers, an article by Jason Hall and Zachary Newman.