Re:Show HN: A 2D game engine in under 1000 lines of C
by jdmoreira on Sunday February 02, 2020 @03:02AM
(#22215802)
You can read some of the criticisms here
https://en.m.wikipedia.org/wiki/Header-only
[ Parent
| on HN ]
Re:Show HN: A 2D game engine in under 1000 lines of C
by macleginn on Sunday February 02, 2020 @08:50AM
(#22216887)
None of them seem relevant for a small-scale unitary project.
Re:Show HN: A 2D game engine in under 1000 lines of C
by chongli on Sunday February 02, 2020 @09:36AM
(#22217079)
Even a large project like SQLite is provided as a single, unified header file!
Re:Show HN: A 2D game engine in under 1000 lines of C
by flohofwoe on Sunday February 02, 2020 @08:55AM
(#22216905)
A better resource is this:
https://github.com/nothings/stb/blob/master/docs/stb_howto.t...
There's an important difference between C++ style header-only libs, where the implementation is often done in inline code (especially for template-heavy APIs) and thus visible in each compilation unit (which is indeed bad for compile times), and "STB-style single-file libs", where the implementation is only visible in a single compilation unit.
The difference between a single .h file and a .h/.c pair is really just different packaging for distribution and integration into projects.