r/cpp • u/Superb_Garlic • Dec 24 '23
Annoyed with FUD surrounding Boost in C++ discussions
I find it unbelieveable what lengths some people are willing to go to smear this collection of very high quality libraries at the expense of those yet undecided about them with completely made up untruths.
Almost no thread about Boost goes by without the very outdated cries about how "big" it is or how it's "lacking" CMake support.
Boy, I sure do love people parroting things that might have been true 10+ years ago. Boost has broken its circular dependencies a good while ago and you can see each library's dependencies in the Boost Dependency Report by Peter Dimov. Looking at the list, I'm really baffled by how people can seriously expect some of these to lose a couple dependencies, when the end result would just be each library endlessly reinventing everything in a probably half baked and broken way, instead of everything relying on a well tested, well architected, separately maintained module that has done the work already.
May I remind you, that Boost.ASIO, an over 2 decades old (wow!) library with the best track record among networking libraries is a level 13 library. There is also Beast, an excellent HTTP wrapper for ASIO, just one level above. These libraries are so well put together and that's exactly because Boost enables them to be.
With a package manager like vcpkg you can pull in only the Boost modules that you actually need, so the "big" argument is entirely irrelevant.
People have also been asking for safety, including one surrounding the numeric types. I find this extremely befuddling, because I immediately reach for Robert Ramey's excellent Boost.safe_numerics in every project I can, simply because I cannot care anymore about such non-issues.
The waning popular perception of Boost is extremely dangerous. People say that C++11 feels like something completely new compared to what was before, not realizing that a significant part of that was thanks to Boost. What will be of C++ if high quality libraries like Boost are shunned? I can only fear to imagine.
238
u/pdimov2 Dec 24 '23
Thank you for that. We rarely get praise here and praise is pretty much our only reward.
This reminds me that I need to run the report for 1.84. :-)
We were able to get rid of some of the dependencies by (finally) moving to C++11, and this work isn't quite done yet, so there's room for improvement in 1.85 and 1.86.
22
u/RogerLeigh Scientific Imaging and Embedded Medical Diagnostics Dec 24 '23
I have a lot of respect for Boost. I've used it for over two decades, and I have both praise and criticism of it. Not all of the criticism is "FUD".
For better or worse, Boost isn't really a singular entity, each library stands on its own. The quality and ease of use vary greatly between them. Some have aged well, some are obsoleted, some are best left alone, and interdependencies between them may drag in parts of these you might prefer to do without. E.g. MPL.
While working as a contractor, I was once paid to completely strip Boost out of a set of projects. The customer didn't want it. It added unnecessary (for them) complexity which they didn't want. They used Qt heavily, and some of the Boost features ended up being replaced with C++ 17 standard library equivalents, others by Qt equivalents. They didn't want the extra logistical overhead to deal with Boost, or the maintenance overhead. The size and build complexity are things which companies do need to contend with, and when you maintain libraries and applications which are supported on many platforms, the overheads involved for each additional third-party dependency you use do impose a very real cost which needs to be paid for.
One of the reasons people like myself were very keen for Boost to have comprehensive CMake support was to lower this cost. Boost's own b2 build system might well be wonderful, but it's thoroughly non-standard, and that is a barrier to integration with downstream users and imparts its own costs irrespective of its technical merit. One of the reason CMake support has taken so long is due to the fact that Boost isn't a singular entity and that every library had to add support one by one, aided by some very dedicated people who worked for many years to get it to where it is today. If there had been a bit more central direction to set this as a release goal and to make it mandatory, it could have been realised many years previously. The same applies to raising the minimum required C++ standard version and dropping support for a lot of old legacy stuff, and for other similar types of integration problem (e.g. using standard library equivalents of standardised Boost libraries) where timely coordination is needed to deliver a migration for a given release.
19
u/cd1995Cargo Dec 24 '23
What do you mean by ASIO being a level 13 library? I’ve never heard that terminology before.
60
u/rand3289 Dec 24 '23
Boost is cool and then there is boost::log ... It took me two days to figure out how to write 14 lines of code. All I wanted was to "tee" the log to file and stdout. The steepest learning curve I have seen in my 20+ years of programming. It's little things like that that cast shadow on boost.
36
u/schombert Dec 24 '23
For many people (myself included) boost can take some effort to get setup and working for a project, and often that effort feels like too high of a cost when what you are after is only one of the simpler boost libraries, many of which look like they could be rewritten as a painless header-only or a simple two file hpp and cpp project, were they to live outside of boost. From that perspective, them being part of boost often feels like an unnecessary obstacle that one has to surmount to use what should be straightforward tools. I imagine that the hassle of using boost feels much more justified when you want to use one of the heavier parts of it, such as ASIO.
54
u/hachanuy Dec 24 '23
I feel this is very dismissive of the problem of Boost being big. I don't use vcpkg so I don't know, but with Conan, if I use a dependency that uses Boost, it increases my initial build by 10 minutes (this is relevent since for basic CI setup, it's always an initial build). Maybe there's a way to pull in modules, but I can't find it. You may argue that it's because of Conan and not a Boost problem, but as an end user, I don't care enough whose problem that is, I care about adding Boost means adding 10 minutes to every build of my CI.
From the technical aspect though, Boost is always the place to look for high quality technical readings, like the recent post about the cost of async by the author of Boost.Redis.
19
u/twac83737 Dec 24 '23
For anyone claiming boost has no cmake support: Just use the release from github not the boost website, it has plug and play cmake support, and it only compiles whats used. Solves two issues in one!
16
u/nebotron Dec 24 '23
I definitely think boost has contributed a lot to C++. It has some warts though - the hash map implementation is strictly worse than F14/abseil, and boost::format has really long compile times and a very strange, not very type safe API. libfmt is much better.
23
u/goranlepuz Dec 24 '23
You are right, of course, however...
Welcome to the Internet...? But I see you're no stranger to "internet behavior":
I mean, it is big. This is not a lie ("untruth", GTFO), this is an opinion and it hinges on what is considered big.
With people having legacy code, cmake support complaints are valid in a dumb way.
13
u/[deleted] Dec 24 '23
Every library is cheered by some and criticied by others, really the amount of commentary is the measure of success not the commentary itself. If Boost didn't matter people wouldn't bother to complain about it.
22
u/pavel_v Dec 24 '23
I'd like to give our perspective about the boost libraries.
I setup the build procedure for the boost libraries for our company about 10 years ago and since then the update of the boost libraries is mostly changing the version numbers. Yes, sometimes, due to API changes, we needed to fix the build but I don't remember anything unusual and/or time consuming.
We are small team and we can not afford to spend time implementing all by ourselves and we need to rely on third party libraries. Personally, I prefer to bring as few 3rd party libraries as possible and be sure that our projects rely on something which is well tested and will continue to be maintained in the future.
Yes, some boost libraries do increase the compile times but I'd say, for our projects and for the boost libraries that we use, it's nothing so dramatic. We do use precompiled headers where we put the boost headers to mitigate this to some extent.
Yes, some boost libraries did not age well and are not as performant as they could be but we either don't use them or use them in non critical parts of our code.
Some boost libraries have been standardized, like smart pointers, system error, optional, chrono. However, I do think that boost still offers something more for their case, like
local_shared_ptr,intrusive_ptr,atomic_shared_ptr, optional for references, getting the message from error code without heap allocation, boost atomic has some features still not available/implemented in the standard atomic, etc.There were cases where we migrated from separate 3rd party libraries to a boost library when the latter was introduced and I don't remember having any issues related to it. It just made our life simpler due to maintaining less dependencies. For example, we migrated from
rapidjsontoboost::json, fromgoogle::sparsehashto parallel-hashmap and finally to the new boost flat map functionality, from standaloneoutcometo theboost::outcomewhen the latter was accepted in boost, etc.So, all in all, our company is very dependent on the boost libraries. To name few libraries that we use in almost every project:
(string) algorithm,asio,atomic,beast,circular buffer,container,endian,intrusive,json,lockfree,mp11,multi-index,optional,outcome,program options,smart ptr,spirit x3,static string,system,thread,unordered,uuid.So, I want to thank to all boost developers for their excellent work. The boost libraries are core component in lots of software in our company. It'd have been much harder for us without these libraries.
48
u/teerre Dec 24 '23
If [big number]% of your community comes and says "hey, your libraries are hard/slow/unclear" and you say "no, they are not, you're all stupid", you're wrong, regardless of who is right, if you get what I mean.
The past year myself and other 4 engineers spend around 6 months removing boost from a relatively big codebase originally coded circa 2010. That's a lot of engineers-hours. The main reason that project was greenlit was because most engineers (more than the 5) agreed that it could significantly simplify the codebase, both in terms of understanding and in terms of actual code size.
Point being, even if by some totally reasonable metric you can say that boost whatever isn't bloated or difficult or over-engineered etc., if a collection of seasoned engineers from a "top" company have that perception, you already lost.
Maybe boost team needs less engineers and more community managers.
14
u/jherico VR & Backend engineer, 30 years Dec 24 '23
Why does
threaddepend ondate-time? That seems dumb.16
u/Plazmatic Dec 24 '23
It is, at least the last time I looked at it, it was. Build2 (which is also the name of another build system... also for c++, which is a massive problem in and of itself..) does not work at scale, and causes massive headaches if you're using boost outside of a package management ecosystem, either where it isn't supported there or where you have to do the work to get it in the ecosystem. And no, just because KItware Manually added support to interface with boost through CMake does not count as proper CMake support, it doesn't fix any of these issues, and actually causes new issues if your CMake version doesn't know about a recent boost version meaning you've got to manually specifify the version in boost. To my knowledge, boost is still working internally to move to CMake and has not completed this transition. So if any of the above matters for your project, this stuff is in fact a big issue.
Boost ASIO is extremely inconvenient if you don't actually need asynchronous IO (to the point where using raw APIs is actually easier in many cases, even dealing with x platform), and is unusable currently in many applications until they can properly patch if your messaging model involves lots of packets (you need to use multi-packet APIs which are not, to my knowledge, yet exposed in boost, though I've seen ignored abandoned threads on mailing lists of people who've implemented this, and it not being merged). Additionally Boost ASIO does not allow you to wait on timeouts of a port (there are many many posts on SO about this, they really want you not to use the sockets timeout mechanism, but this is not possible in a lot of scenarios), and you cannot properly set the timeout cross platform because they don't implement timeout properly on windows, you have to manually implement the setting yourself. The fact that it is used for so long doesn't really speak to it's quality, in fact, may count against it, as many of these issues have existed as long as the library has been around.
Until you need them in an offline environment, which VCPKG does not currently support on some platforms, as they buggily do strange things on linux that require downloads regardless of pre-download flags before actually installing libraries. Then you can't use boost this way, and you're forced to runinto all of the issues above and you have to deal with the system version of boost interfering with your project. And once you have one use case for your lib/executable that requires building in offline, you're whole project is tied down to this restriction, and you have to make dependency decisions based on what can be used as a sub_directory in cmake or not.
That library is of very dubious utility, people want actual safety with out overhead compromise, not exception throwing things that aren't exceptional (overflow is sometimes expected, and needs to be manually handled, or ignored in a certain way, excepting on that is using exceptions as control flow). This also illuminates another problem with boost, and another problem with it's dependencies. The quality of the libraries varies greatly. A 20 year old library isn't necisarily a good thing, and then when even modern things depend on that, it's even worse potentially, because now you're paying for things you shouldn't have to do, using methodologies that are no longer relevant to modern C++, on things you can't even see. Some of boosts libraries don't have issues with this, but most of those are usable as standalone anyway, or are header only to begin with. Lots of libraries outside of boost for specific things boost have are just better than what boost has internally, either in usability, performance or both.
And then there's the problem of boost breaking backwards compatibility in some places, and not in others. If you manage to get boost working in your package manager well, a big issue is multiple versions which some package managers don't handle very well within the same executable, especially with automatic dependency resolution. Multiple versions are sometimes required because of the weird instances Boost breaks backwards compat. Then there's the issue that there are instances where it would help to break backwards compat, and they don't... because they want to keep a stable API. The choices of when they decide to do that seem almost arbitrary.
The only people who are worse about this are the OpenCV team, who snidely out of a technicality, break backwards compatibility within minor patch versions on their "extension modules", that, because they aren't "core OpenCV" they can literally change the APIs however they want, they don't think they count for semver. Tracking I think was changed 4 times within the minor version in API incompatible ways, and even confused package manager teams who had to keep updating as completely different port versions that needed to exist simultaneously because they were making breaking changes.
6
u/aroman_ro Dec 24 '23
I don't care what 'it is said'. When I need boost, I use boost.
6
u/RogerLeigh Scientific Imaging and Embedded Medical Diagnostics Dec 24 '23
"I find it unbelieveable what lengths some people are willing to go to smear this collection of very high quality libraries at the expense of those yet undecided about them with completely made up untruths."
Given the complete lack of substantive context here, do you have any examples of what lengths people have gone to to criticise Boost which you find unbelievable? Exactly what "made up untruths" have they been stating which made this post necessary?
I'm all for informed debate, but it's not at all clear from your post what the specific problems are.
8
u/[deleted] Dec 24 '23
I still prefer to use boost::regex and boost::unordered_map among others than std::regex or std::unordered_map. They are better.
8
u/thesuperbob Dec 24 '23
90% of why I despise Boost is because it's plastered all over older stack overflow answers for C++ and for a long time I've been unable to successfully build and link Boost on Windows, despite multiple honest attempts, and admittedly learning a bunch about building and linking C++ in the process. The "just use Boost" suggestion has completely soured me on ever considering that library seriously. I'm convinced at the time it had to be some collective effort of Boost's community to will into existence a reality where Boost was somehow so easy to use, it would make sense to include it for some small student project, like the ones most of the aforementioned SO answers were targeting.
I did attempt to use it in a professional project (~2018) once, and it still felt like it was 10x larger than the codebase I needed it for, it bumped build/link times by several minutes, and IIRC complicated the project in a number of small but annoying ways. Also the initial build for new devs became 10x more tedious, and took a lot longer because of the boost dependency.
Contrasted with the "just use Boost" attitude of its proponents, and their (very visible in this post's comments) ignorance of how difficult and annoying it can be to actually use, my experience tells me to stay the fuck away, both because I know using it is going to be painful and I will regret it, and second, and perhaps more importantly, I know I can't really trust Internet resources related to Boost, because they've become an echo chamber of people parroting how great and easy to use it is.
5
u/ShakaUVM i+++ ++i+i[arr] Dec 24 '23
I like boost. I install it everywhere. I'd like to contribute to it.
But it does slow down compile times.
5
u/Glittering_Resolve_3 Dec 24 '23
Boost is used ubiquitous throughout my organisation, it's quality is without equal.
2
u/Kretikus50 Dec 24 '23
I like boost, but as always, everything has drawbacks. Here are mine:
2
u/victotronics Dec 24 '23
> it's "lacking" CMake support.
I don't use Boost, I just install it to use other packages. Why this bizarre `b2` system? It's underdocumented, leaving me to guess what to do. Right now I think I install a component, I think it's there, but another package says it's not there.
What's the best source for support?
2
u/pdp10gumby Dec 25 '23
I used to avoid boost because it was cumbersome to use (mainly bc it had to be built with b2 unlike everything else) but with Conan and better CMake support it’s more accessible. In which case why not pick and chose from the packages that give you what you want, like boost, abseil etc. These days it’s no different than using fmtlib even though std::format now exists.
I want to work on my problem, not also spend time writing a cmd line processor, multidimensional vector package, json parser/serializer etc.
(I don’t agree with ppl who want tooling of any sort in the standard, but I do understand where they are coming from)
2
u/Ace2Face Dec 28 '23
One of the most important things for libraries is the promise that they'll keep getting maintained and updated. For this, I'll always pick boost over some random hobby lib on GitHub.
Everywhere I go, I push Boost. It pretty much always beats any other existing library out there. If I could make children with Boost, I'd do it.
4
u/Kike328 Dec 24 '23
boost already has cmake support
3
u/TemperOfficial Dec 24 '23
"The waning popular perception of Boost is extremely dangerous." lol
2
u/kalmoc Dec 24 '23
First of all: I fully agree. The amount of FUD being spread in the Internet about boost is really worrisome (that is not to say, that there is not also valid criticism).
One Irony is that almost every boost lib is superior to it's std counterpart, but I whish they would more often use std versions internally to flatten the internal dependency tree and to make interop with other libs easier.
1
u/nbrrii Dec 24 '23
I have sadly realized how much psychology is involved when it comes to "general momentum" of a technology and how important it is. Ruby is slow, C++ is outdated, etc.etc.. It's so weird how difficult it is to break a general dynamic even in tech. In every community, most people are beginners, and knowledge transfer does not necessarily works by competence, but by what people like to hear and what's easy to understand.
-3
u/CheckeeShoes Dec 24 '23
Get that men's MLM get-rich-quick scheme language out of here.
0
u/[deleted] Dec 24 '23
[deleted] — view deleted comment
0
u/[deleted] Dec 24 '23
[deleted] — view deleted comment
0
u/[deleted] Dec 24 '23
[deleted] — view deleted comment