Written by thoughtbot

Announcing the Classical Code Reading Group of Stockholm

If I were to say that someone is weaving a tangled web, Hell is other people, or if you build it they will come, you would know what I'm trying to express. You know what a catch-22 is. There is a fear of waking up to discover that you are a giant insect, and the phrase "it's alive!" conjures up not just Frankenstein's monster but also its poor, misunderstood fate.

So why can I not reference the way the echo program prints a space between each argument, the way GNU false uses C trickery to avoid code duplication, or the classic constant 0x5f3759df without the same recognition?

These are our classics. Not only are these programs we use every day, but they're written by some of the most influential programmers of generations past, inspiring not just entire operating systems but also design patterns large and small.

The Classical Code Reading Group of Stockholm reads the classics.

In our pilot meetup we examined echo.c across five different implementations. From OpenBSD we learned about minimalism, including this statement that would bring pride to every nihilist:

(void)fputs(*argv, stdout);

NetBSD taught us about dotting our i's and crossing our t's, including flushing standard output, watching the return types, and that errors can exist anywhere. From FreeBSD we learned to love again, embracing not the stark minimalism of OpenBSD but instead the industriousness exploration of bare metal input and output.

The GNU echo and its predecessor, the GNU bash echo builtin, showed how to cleanly handle backward compatibility in the face of the complex forward march of progress, including hexadecimal parsing, environment variables, well-named keywords, and short-circuit termination.

This excursion down the guts of echo.c took three hours, with a break for food and drink.

So grab your sense of adventure and join us as we explore true and false, from shell to shining C, and see just how GNU managed to hit 78 lines for this classic, tiny app, at the next Classical Code Reading Group of Stockholm event on the 21st of October.