Archive

Emulating "defer" in C, with Clang or GCC+Blocks

In the Go language (and now Apple’s Swift), there’s a new control-flow mechanism: defer.

When you tag a function call with the defer keyword, its execution is deferred until the end of the current scope. This makes it easy to construct an ad-hoc use of the RAII pattern — handy for placing resource initialization and finalization next to each other, to make it less likely that you’ll forget to finalize a resource.

I was curious whether it was possible to do something similar in C. It turns out it’s pretty straightforward.

Project Ruori encounters electro-music, a suit of armor, and a fallout shelter

Project Ruori, a pseudorandomly generated collective of humans and machines, sent several delegates to this year’s Asheville electro-music festival. We came prepared with knowledge gained from last year, for example: if it smokes, unplug it. The human delegates — Steve Mokris, Melissa Egan, and Jaymie Strecker — now present their report of this year’s proceedings.

Who were the jockeys in Muybridge's photographs?

Before 1878, few people knew what a galloping horse looked like in slow motion. That changed when Eadweard Muybridge, witnessed by the local press, used a clever apparatus to take a series of photographs as a horse galloped by. The result was “Sallie Gardner at a Gallop”, a.k.a. “The Horse in Motion”. Back then, you could watch the series of photographs as a movie on a zoopraxiscope. Today, you can watch it in an online video.

I first became aware of this piece of history when my co-worker Karl Henkel made a colorful rendition of related photographs, “Annie G. Galloping” (pictured at right). I looked up the story behind these photographs, but it didn’t answer the question I was wondering about: Who were the guys riding the horses?