Blogging has been light recently because I’ve been working very hard on a major GPSD release, which I just shipped. This is mostly new features, not bugfixes, and it’s probably the most new code we’ve shipped in one release since about 2009.
Month: November 2013
Finally, one-line endianness detection in the C preprocessor
In 30 years of C programming, I thought I’d seen everything. Well, every bizarre trick you could pull with the C preprocessor, anyway. I was wrong. Contemplate this: #include <stdint .h> #define IS_BIG_ENDIAN (*(uint16_t *)”\0\xff” < 0x100) That is magnificently awful. Or awfully magnificent, I'm not sure which. And it pulls off a combination of… Continue reading Finally, one-line endianness detection in the C preprocessor