> In general, STB-style headers simplify C/C++ build system shenanigans.
Too vague. How is it better, concretely?
> E.g. one benefit is that you can configure the implementation via preprocessor defines without the defines leaking into the build system
That's not a benefit. How is this:
#define LIB_IMPLEMENTATION
#define LIB_KNOB 123
#include "lib.h"
Any better than the two-file version:
#define LIB_KNOB 123
#include "lib.c"
?
> It's also trivial to write "extension headers" which need to directly peek into the (otherwise private) implementation of the base library. Just include the extension header implementation after the base library implementation.
I'm not sure what this means. Can you give an example? Is this being used in the above library?
> PS: but also see: https://github.com/nothings/stb#why-single-file-headers
OK, that only offers this explanation:
> Why not two files, one a header and one an implementation? The difference between 10 files and 9 files is not a big deal, but the difference between 2 files and 1 file is a big deal. You don't need to zip or tar the files up, you don't have to remember to attach two files, etc.
This is kind of nonsense to me. The difference between 2 files and 1 file is barely relevant, and doesn't weigh against the awkwardness of having no clear distinction between declarations and definitions, and having to pull in definitions by setting a magic preprocessor header.