3 ms·
By "instantiate", I mean to insert the actual implementation in one .c/.cpp file you write. This is a typical strategy used by single header libraries. It can b
by attractivechaos 6y ago
By "instantiate", I mean to insert the actual implementation in one .c/.cpp file you write. This is a typical strategy used by single header libraries. It can be done in two ways in a .c file: a) call a huge macro after #include to insert the actual code and/or b) define a macro like "#define LIBRARY_IMPL" prior to #include to let the header insert the code. Single-header libraries don't necessarily have the problems you are describing if implemented properly.
The owner of this repo is a well known figure on game development. His libraries are somewhat widely used and have probably inspired quite a few single-header libraries which adopt similar strategies. My comments are not specific to his libraries, either.
- quietbritishjim 6y ago> By "instantiate", I mean to insert the actual implementation in one .c/.cpp file you write I know. In my original comment I tried to make it clear that some (but not all) of my points applied to these libraries that have some separate compilation. In my second comment I apologised for not making that clear and tried to stress it even harder. I'm not sure what else I can do to make it clearer. > The owner of this repo ... His libraries If you just use this guy's libraries, and that works out for you, then all power to you. But I'm worried about C++ beginners stumbling across this page on Hacker News and thinking, hmm, using C++ libraries is so hard that I need to restrict myself to libraries like these. That is simply a myth - using vcpkg is really not hard at all, and well worth it for all the other libraries it gives you easy access to. Again, if that doesn't matter to you then that's fine, but I want readers to know that the option is available. By the way, that the vast majority of libraries linked to from this article are not by the author and do not have the separate compilation model you talked about - they're simply header only with inline functions.