Clifford’s (aka, Claire’s) Device in C and C++ (opens in new tab)
Introduction If you’ve been programming in C or C++ for a while, you likely have heard of Duff’s Device that takes advantage of C’s often-derided “feature” where case blocks “fall through” into the next case (if any). Regardless of what you think of that, I only recently discovered that there’s another “device” known as Clifford’s Device (alternatively known as Claire’s Device). While the problem it solves is completely different from Duff’s, it uses on another of C’s quirks. Preamble Sometim...
Read the original article