4 ms·
To me, the damning thing is that so many people distribute “header-only libraries”. My experience is that this makes the library worse in many different ways, e
by klodolph 6y ago
To me, the damning thing is that so many people distribute “header-only libraries”. My experience is that this makes the library worse in many different ways, except one—linking is easier. Developers are so annoyed with dependencies that this is the result. There are much better solutions than just shoving everything in a header.
- nn3 6y agoHeader only usually means terrible compile times. So what they are saving from writing a few lines of Makefile they will pay forever in far longer feedback loops during development. Also it's well known that if the compile time goes over a specific threshold the development productivity drops dramatically because you can't do interactive debugging and exploration anymore. It's really a terrible tradeoff.
- panic 6y agoAt least in C, "header only" libraries typically require a #define LIBRARYNAME_IMPLEMENTATION somewhere in a .c file to define the symbols declared in the header. That way you're not including a copy of every function in every object file, which is what would slow down compile times. C compilers are very fast at skipping #ifdef blocks.
- curlypaul924 6y agoThe main reason IME for a header-only C++ library is that when it is template-heavy (as a lot of C++ code is these days), a lot of it ends up in headers anyway, so it's not a big leap to header-only. I've never seen a widely used header-only C Lucas library, and while it wouldn't surprise me, it seems harder to justify.