C++ (C too) header-only libraries are badhttps://schneide.wordpress.com/2018/04/30/c-header-only-libraries-are-bad/ …
-
-
Vastauksena käyttäjälle @bkaradzic
The portability/drop-in argument drives me nuts. You’re sacrificing a lot (readability, organization, inlining vs link) to optimize a process that you do once per library. As opposed to how many hits are spent reading/debugging the lib.
3 vastausta 0 uudelleentwiittausta 1 tykkäys -
Vastauksena käyttäjälle @tloch14
Readability is in no way significantly impacted by putting things in one file and you don't have to inline everything in a single file library. This is the strangest bikeshed honestly.
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjälle @dotstdy
Inlining comment I'll bow out to. Readability I won't. I've seen header-only libs that are 80% utilities and setup all on top. Bottom 20% are things I actually want. When all in one file, difficult to understand what is what, where separations are.
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjälle @tloch14
and how is that any different from trying to figure out the same questions but across multiple files haha
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjälle @dotstdy
I'm sorry you don't understand the value of organizing large amounts of code across multiple files.
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjälle @tloch14
I mean the way a library is distributed has very little to do with this, and anything that falls under large amounts of code doesn't generally fall into the single file library category either. so I'm not sure how it's relevant
1 vastaus 0 uudelleentwiittausta 0 tykkäystä
It normally plays out like this, if the lib is small enough to be single header only, I’ll probably write it myself. If the lib is large and crammed into single header only, it’s unwieldy.
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.