I'd be curious to know if systemd is tickled by this one weird trick to crash your server. It does work with inotify (and other fun newish kernel techs), so it would be subject to the inotify queue length...but what'll happen when it hits it?
$ git clone git://anongit.freedesktop.org/systemd/systemd systemd-git
$ cd systemd-git
$ grep -r "assert(" | wc -l
7771
That looks pretty bad at first. But I noticed this in src/shared/macro.h: /* We override the glibc assert() here. */
#undef assert
#ifdef NDEBUG
#define assert(expr) do {} while(false)
#else
#define assert(expr) assert_se(expr)
#endif
I didn't verify that macro.h was included by every file that used assert(). But I'm assuming it does. So it looks like assert() at least doesn't call abort() in their world. In fact, it's a nop in non-debug builds. And even in debug builds, the assert_se() macro logs a message and continues.I didn't check for any external libraries systemd might use.
I believe it violates the principle of least surprise, which I generally would consider a good principle.
As a new reader of the code, you'd be quite sane to expect "assert" to mean assert(), not "our local assert(), which is something different".
There should be a --disallow-keyword-redefinitions flag to the preprocessor, or something. Grumble.
Also, invoking the principle of least surprise on a C codebase is just ludicrous.
I would think it just as bad an idea to overload `NULL` with something non-standard.
The standard things in the language are something to be learned, and they should remain constant and not change per-project just because someone can do it differently. Do it however you like, but don't clobber the standard names, is all I'm saying.