3 ms·
technically, "header only libraries" can be exceptions to C code not being in header files. See STB as an example https://github.com/nothings/stb https://github
by zoezoezoezoe 1y ago
technically, "header only libraries" can be exceptions to C code not being in header files. See STB as an example https://github.com/nothings/stb https://github.com/nothings/stb. The advantage theoretically is that you can #include this library and use its code and types from just one file, its a decent model IMHO, but it can be jarring to someone unfamiliar with header only libraries.
- uecker 1y agoThey have plenty of downsides and only one very minor advantage: You need to copy only a single file instead of two into your source. I am still puzzled why anybody could think this is a good idea...
- 1718627440 1y agoAnd you also can name your single file to be included .c instead of "hiding the truth".
- 1718627440 1y agoYou can include a .c file just fine.