Google Protocol Buffers Libraries for C

Google Protocol Buffers have become a very popular serialization mechanism for simple to complex/variant data structures. Due to the variation of message formats in a given protocol, the presence and/or lack of fields on an ad-hoc basis makes implementation in the C language somewhat of a challenge. Three Protocol Buffers Libraries for C Thanks to […]

Nicer C99 APIs with Designated Initializers

While working on a library for property-based testing in C, I discovered a trick that can be used to make significantly nicer library interfaces in C99: “designated initializers”. As of C99, struct literals can have their fields set by name, in any order. The C99 standard explicitly updated the behavior for how fields in struct […]

Talking SPI on Raspberry Pi

The Serial Peripheral Interface (SPI) Bus is used for communication between microcontrollers and other digital devices. On the Raspberry Pi it can be very handy for doing things like acquiring values from an Analog-to-Digital converter, reading a temperature sensor, or communicating with another microcontroller. When using SPI on the Raspberry Pi, there are many options […]

Functional(ish) C# & MVVM: Single-Responsibility and Code-as-Data

I’ve spent the last year working in C# and WPF. Over a few blog posts, I have alluded to a particular pattern of structuring code, referring to it as “stateless single responsibility” objects or “stateless SRP” objects. For the purposes of this post I will call the pattern “stateless single responsibility principle” (SSRP) objects. I’d […]