6 ms·
The biggest problem with C++ (in my opinion) is a lack of a good library manager. As installing C++ libraries is a pain, and testing them on a large range of c
by CJefferson 15y ago
The biggest problem with C++ (in my opinion) is a lack of a good library manager.
As installing C++ libraries is a pain, and testing them on a large range of compilers is a pain too, the only library of note anyone ever uses is boost.
Most of Boost is a horrible templated mess. I consider myself fairly expert on C++, have contributed code to both clang and g++, and worked on C++11. I still don't use boost, and am slowly taking it out of projects which it has infected.
Boost is interesting as seeing how the bounds of C++ can be pushed, but as a library for day-to-day use it is horrible. It is just about usable if you limit yourself to a few small pieces. For example at first glance boost::spirit is a really nice parser library. However the error messages give me shivers to this day and a parser I wrote using it takes over 1GB of memory and 40 seconds to compile.
- makmanalp 15y agoAren't horrible template errors the compiler's fault and not the language's (or the library's as you suggest)?
- Symmetry 15y agoThey are if its due to compiler laziness, but in C++'s case it seems to be the fact that its genuinely hard to compile.
- stonemetal 15y agoI would say the fault lands on all three. The language could have been designed such that good error messages where easier to output. The library authors could have made an attempt to force better error messages. Finally compilers could get their act together and output good error messages.
- rubashov 15y ago> Most of Boost is a horrible templated mess. Are you just saying you find the implementation distasteful? I don't find using the templated boost stuff problematic. Most of the time you just cargo cult examples from the documentation and all's good, but then you have great flexibility should you need it.
- tptacek 15y ago"Most of the time you just cargo cult examples from the documentation". Yes. This.
- rubashov 15y agoThat's how any API is used 90% of the time.
- tptacek 15y agoDisagree. And, tip: don't say that at a job interview.
- rubashov 15y agoTip: don't be a glib, smug prick on a date. Please enunciate why something like asio is evil. You review the documentation and examples and the outlined primary use cases "just work". But you can dive in and do really complicated things.
- tptacek 15y agoI don't think any of Boost is "evil", and I haven't mentioned asio --- asio came out after I was done using Boost. But I agree with you that a lot of C++ code works because it's part of a cargo-cult culture, not because the interfaces themselves are particularly well- thought- out.
- jules 15y ago> you just cargo cult examples from the documentation This mindset, and libraries that are basically only usable in that way if you don't want to invest months of your time are the bane of programming. Library writers, please: 1. Design the API by thinking about how it will be used, not how it will be implemented. 2. Make sure that your publicly exposed interface can be specified simply. If your specification is anywhere near as complex as the code implementing it you know you're doing something wrong; your library is not reducing complexity.
- minimax 15y ago> the only library of note anyone ever uses is boost. I think the Qt people might have something to say about that.
- slug 15y agoI consider Qt to be more a framework than a library per se. The fact of being written in C++ is probably irrelevant, since you usually don't link to it from other projects (say ncurses, gtk based), you use it to build a Qt application or extend it (like the KDE project). With boost you usually pick and choose and include parts of the (templated) libraries directly into your project directory, so you don't have to embrace it in full.
- jbk 15y agoSorry, but no. You can use libQtCore or libQtGui without the rest. Or just libQtCore + libQtSQL for a server. You can even mix them inside an application that is not a QApplication.
- angstrom 15y agoDon't stop there: bsdiff, bspatch, bzip2, dtoa, hunspell, ICU, JSCRE, libjpeg, libpng, libxml, libxslt, LZMA SDK, modp_b64, Mozilla interface to Java Plugin APIs, npapi, nspr, nss, Pthreads for win32, sqlite, tlslite, V8 assembler, WebKit, WTL, zlib, pcap, winpcap, openssl
- asher 15y agoI think he meant C++ library. Lots of the libraries you mentioned are C libraries.
- 16s 15y agowxWidgets too. I also know a lot of guys who use Crypto++ and Botan (both C++ class libraries).
- roel_v 15y agoPlease tell what is wrong with libraries such a datetime, regex, filesystem, bind, shared_ptr, string, test, uuid, just to name the ones I use regularly. Also please tell what you would suggest as replacements, and why they do not share the deficiencies the boost versions do according to you. It's easy to hate on templates, and not is all perfect in C++ or boost, but boost is the best thing to happen to C++ to make it easier to use, or rather to alleviate some of the most annoying and unnecessary drawbacks of the language. I'm not questioning your expertise, I'll take your word for the accomplishments you mention - but your apparent disdain for it is, to put it mildly, lightly substantiated and shows more signs of ideologically fueled hatred than of a deep understanding of the negative sides of something that can only be developed through much experience.
- to3m 15y agoSometimes, you can see the negatives straight away. No experience necessary! A 40 second compile time is a pretty big negative. I wouldn't even suggest this is exaggeration; my experience with boost is not that wide-ranging, but what experience I have does include waiting for programs to compile. (Maybe experience is even the problem. A C++ programmer might suck up a 40 second round trip time, but I bet no PHP or Python programmer would!) Large C++ projects already tend to suffer from monstrous compile and link times. Anything that increases build times is inherently a bad idea. Iteration time has been THE major issue on every project I've worked on. Sucks up man-hours like nobody's business. All the other C++ junk... borderline irrelevant, by comparison.
- stonemetal 15y agoThere in lies the problem boost is a collection of libraries that are more or less unrelated to each other. So sure spirit is a major pile of template catastrophe, as are some of the others (boost::lambda was my introduction to something I should never do with templates.) Then you have the others. FileSystem has nary a template in sight, Asio and Thread have a few but they aren't crazy.
- chancho 15y ago
- 16s 15y ago> Boost is interesting as seeing how the bounds of C++ can be pushed, but as a library for day-to-day use it is horrible... I use Boost daily. I absolutely love it. It's wonderful. I could not do my job w/o it. Much of it is in the new C++11 standard too.