« Stippler 1.0 source release | Newest entries in software | Netflix to Aether converter » A few weeks ago, I posted a humdinger of an assertion. A little investigation shows that this is actually the very legible
but the glibc headers have code which turns strncmp(c1, c2, n)
into strcmp(c1, c2) when one of the strings is constant and shorter
than n (this probably happens a lot in defensive code):
while strcmp is in turn defined to a completely nutty bit of code
which seems to have something to do with inlining comparisons where at
least one string is a short constant string (again, something that may
happen quite a bit in practice).
I am a lover of macros, having written a few humdingers of my own, but nothing to rival the sheer majesty of the ones found in glibc's internal headers. If you value your sanity, you'll steer clear of <bits/string2.h>. As a parting gift, here's one of the "humdingers" I recently wrote, part of a Python wrapper for part of the OpenGL API:
(tsk tsk, I didn't carefully align the backslashes like the glibc author)
It's used like this: which I defend as a really convenient way to write the wrapper for the gluPerspective call. But at the same time, I can imagine the horror of some future maintainer of my software, the first time he sees my macro. Don't worry. This burst of empathy won't actually change the way I write software...GLCALL4V(gluPerspective, "dddd", double, double, double, double); |
| [æ] |