Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming

Comparing the C++ Standard and Boost 333

Nerval's Lobster writes "The one and only Jeff Cogswell is back with an article exploring an issue important to anyone who works with C++. It's been two years since the ISO C++ committee approved the final draft of the newest C++ standard; now that time has passed, he writes, 'we can go back and look at some issues that have affected the language (indeed, ever since the first international standard in 1998) and compare its final result and product to a popular C++ library called Boost.' A lot of development groups have adopted the use of Boost, and still others are considering whether to embrace it: that makes a discussion (and comparison) of its features worthwhile. 'The Standards Committee took some eight years to fight over what should be in the standard, and the compiler vendors had to wait for all that to get ironed out before they could publish an implementation of the Standard Library,' he writes. 'But meanwhile the actual C++ community was moving forward on its own, building better things such as Boost.'"
This discussion has been archived. No new comments can be posted.

Comparing the C++ Standard and Boost

Comments Filter:
  • Boost Sucks (Score:2, Insightful)

    by Anonymous Coward

    There, I've said it. It's obscuratist beyond all reason and results in incomprehensible code of the type that any professional programmer should be ashamed of.

    • Re:Boost Sucks (Score:5, Insightful)

      by AuMatar ( 183847 ) on Friday March 15, 2013 @10:11AM (#43182641)

      Boost is sort of like CPAN for perl- its a repository of libraries you can pick and choose from. It has some really useful things in it and a lot of crap. Talking about how good/bad Boost is is pointless, from a code perspective. Talk about how well or not well it works as a repository.

      Of course, that makes the linked article pointless too- programmers write libraries for a language faster than the standards committee updates it? No shit. If they didn't, we ought to be worried.

      • Re:Boost Sucks (Score:5, Insightful)

        by Anonymous Coward on Friday March 15, 2013 @10:58AM (#43183079)

        Boost has on the order of 100 libraries [boost.org] , each of which undergoes a peer review
        CPAN allows anyone [cpan.org] to upload their own code and has on the order of ~120,000 libraries.

        Boost is a lot less like cpan and more like the development branch of the next standard library.

      • Re:Boost Sucks (Score:5, Insightful)

        by PhrostyMcByte ( 589271 ) <phrosty@gmail.com> on Friday March 15, 2013 @11:06AM (#43183171) Homepage

        It sounds like you're missing the significance of Boost. I cant think of any other thing like it, CPAN included. Yes, it's a collection of libraries. That's not the interesting part. There's a reason so many of the C++11 library additions were taken directly from it with little to no changes.

        Most projects you'll find code to the standards of the one or two people making them. The good ones are fairly flexible, but many of them fulfill just the specific needs of those authors.

        Boost lies somewhere between that typical project design and a standards body. Its review process demands high-quality standards-worthy code without taking years to debate on something before anyone actually writes any code. Once libraries actually get in, it serves as an incubator to find out what works and what doesn't. Because it is coded to such a high quality and people are actually using it, it gives the standards body a lot of data to work with in deciding what should be next for the language. That's what makes it special.

    • This is why I hate javascript libraries like jQuery. The resulting code looks incomprehensible to someone who never used jQuery. Adding a 80KB+ download and another layer to a godamn interpreted language is just the cherry on top of the insanity.

      • Re: (Score:2, Flamebait)

        by RaceProUK ( 1137575 )

        This is why I hate javascript libraries like jQuery. The resulting code looks incomprehensible to someone who couldn't be bothered to spend five minutes leaning the basics of jQuery.

        FTFY

    • Re:Boost Sucks (Score:5, Insightful)

      by Joce640k ( 829181 ) on Friday March 15, 2013 @11:18AM (#43183301) Homepage

      There, I've said it. It's obscuratist beyond all reason and results in incomprehensible code of the type that any professional programmer should be ashamed of.

      Agree 100%.

      Libraries are supposed to be understandable and easy to use. Boost just isn't. I don't know if the documentation or the design that's at fault but it always seemed totally opaque to me whenever I looked at it.

      I could probably grok it if I invested enough time/effort, but what I get in return (eg. a reference counted pointer) never seemed worth that investment.

      YMMV.

      • I wish they had taken a look at Qt instead. Qt is pretty similar in that it's C++ metaprogramming, and adds a bunch of libraries on top of C++ and new keywords and such (like foreach for dealing with container classes). However, the resulting code is extremely easy to read, unlike the Boost examples I've seen.

  • what are the odds.

  • by iggymanz ( 596061 ) on Friday March 15, 2013 @10:07AM (#43182607)

    instead of verbose vagueness need to have lists of comparisons between standard libraries and boost. is this author practicing to be paid by the word?

    • The author is a slashvertising Dice employee who clearly isn't that much of a programmer judging by what he wrote. His story read more as kind of a 'heres how I show you I'm a newb' than anything else.

  • by Anonymous Coward on Friday March 15, 2013 @10:11AM (#43182639)

    I just cannot embrace the mess C++ became anymore. Life is too short to learn C++. Basically I'm using "C with classes" today, without STL, Boost or any of these aberrations.

    • by AuMatar ( 183847 ) on Friday March 15, 2013 @10:19AM (#43182709)

      The container classes (list, map, vector, etc) in the STL are good enough to be worth using. And of course string. Going full out with functors, generic programming, etc does frequently make an unreadable mess, but no need to throw out the good parts with the bad.

      • by deKernel ( 65640 )

        I have to agree 100% with your comment. If you want to make a mess, C++ sure will let you (kinda like C). But, if you don't let yourself wander around with all of the possible functionality and just stay with the basics, C++ will allow you to do just about anything you want in a truly readable and supportable way.

        • Hell, last place I worked they gave me a reference implementation of a C# webservice that had a single method call... that was comprised of 60 .cs files. (yes!! I know!!)

          So its easy to make a mess in any language, it is entirely down to the coder. If you consider yourself a uber-coder who can write the most convoluted templated C++ code, then I have to tell you that you're useless. Similarly, if you take 60 classes and interfaces to make a single-method web service, you're also useless. It doesn't mean C++

          • I have to disagree - if you actually *are* an uber-coder who can write *reliable* convoluted code you may be extremely valuable *if* properly utilized. Because sometimes truly hideous convoluted code really is the best solution, *if* it allows you to concentrate a lot of ugliness that would otherwise be scattered throughout the larger code-base behind a simple, clean interface - just look at the actual implementations of some of those nice, easy-to use Boost and STL libraries.

            Heck, I've written some truly n

      • by tibit ( 1762298 ) on Friday March 15, 2013 @03:44PM (#43186093)

        I don't know what practical problem does std::string solve, because sure as heck it doesn't provide most of what you actually need to use strings in real life applications. Qt's QString and the associated codec infrastructure is pretty much what you need. std::string is a solution to a problem that nobody has. If all you need is to pass around safe arrays of characters, then std::vector does it for you, duh. std::string is a safe wrapper for C strings, and that's the whole problem: modern software has outgrown C strings two decades ago.

        • by martin-boundary ( 547041 ) on Friday March 15, 2013 @06:40PM (#43187393)
          Prior to std::string, everyone wrote their own proprietary, incompatible, C++ string classes, and if you used third party libs, you'd end up with several such. So the mere fact that std::string exists has reduced bloat and complexity.

          However, the std::string classes were designed too soon, and a lot of the member functions are clumsy and should have been offered as generic stl algorithms. It's probably best to consider them deprecated.

    • Then you're not making the most of it, or not doing anything sufficiently complicated to warrant use of such a library.

      That's fin. You're not the target of these things. But maybe you are. But be aware by using a best-of breed toolkit:

      - Common operations are always done by 'best-practices'. Your employment and talent pool are 'standard' meaning finding talent that knows how to work in your code base is not a problem. As well as you knowing how to work in other's code.

      - simple stuff like foreach() and other

      • - simple stuff like foreach() and other iterators eliminate off-by-1 errors and boundary conditions.

        To me, the distaste for iterating over a counter (i.e. a traditional C for loop) is the perfect example of much ado about nothing. If your implementation of "apply" gives me parallelism for free, then great, but otherwise it's one of those obsessive stylistic things that really does not matter.

      • by AuMatar ( 183847 )

        Disagree. Using foreach with a function pointer or functor separates the body of the code from the loop implementation and greatly increases debugging time and maintentance cost. It hurts more than it helps. This isn't true for other languages like perl, Java, etc where the implementation is cleaner, but the STL foreach is garbage.

        • by tibit ( 1762298 )

          Agreed. If C/C++ at least had local functions, you could put the body somewhere close, or even right where it belongs by using a wrapper macro. I find it hilarious that shit that was a well solved problem in Pascal never made it to C++. The pimpl idiom is completely unnecessary in Pascal, because separation of implementation from interface is a part of the language. In C++ it's a yet another manual task you have to deal with, and you always pay for it in non reference-counted classes -- it costs you the ext

      • "Then you're not making the most of it, or not doing anything sufficiently complicated to warrant use of such a library."

        Apparently you either haven't heard of Linux, or are under the delusion that it "isn't sufficiently complicated". Plenty of "sufficiently complicated" software gets implemented fine using C in a "C with classes" style sans STL, Boost, etc. C++ with STL, Boost, etc. is a way to do what you describe, not the way to do it.

    • That's a very short-sighted view. Boost is a credit to the community that created it and so is the STL. They might not be the best tools for every situation, but I dare say they aren't "aberrations". C++ and the STL aren't really difficult as long as you're a disciplined programmer.

    • If you're using malloc() instead of std::vector, std::string, etc. then you're doing it very very wrong.

      RAII is what makes C++ robust, reliable and scalable, and you're fighting against that.

      ps: new[] and delete[] are nearly as bad as malloc() (and are one of the few things that should be deprecated from the language IMHO).

    • Re: (Score:2, Insightful)

      by blackcoot ( 124938 )

      I just cannot embrace the mess C++ became anymore. Life is too short to learn C++. Basically I'm using "C with classes" today, without STL, Boost or any of these aberrations.

      Out of curiosity, is this desire for self-inflicted misery part of a larger BDSM kinda deal or is it due to willful ignorance of standard practices and idioms that have been well entrenched in the C++ community for the better part of a decade now?

    • by heson ( 915298 )
      Read Stroustrup, code C++ the right way. (i.e C extended by the possibilities of c++, opposed to schoolbook object oriented language with a tendency to over complicate)
    • C-like-C++ kinda combines the worst of both worlds.

      At that point, I think you'd be better off using straight C (which I like a lot and think is the best tool for most jobs), or full C++ (which bugs me, but I admit I like the STL better than C collections).

  • by scorp1us ( 235526 ) on Friday March 15, 2013 @10:22AM (#43182733) Journal

    We had decent (not perfect) C++ support. Now we go and fragment the industry by inventing a new standard. Code developed to the 0x11 standard won't work on legacy systems with legacy compilers.

    Meanwhile boost and Qt worked around the C++ limitations without introducing any compiler differences. I think that was the right approach. True not all things could be delivered without messing with the compiler, but a good many were.

    Now my only problem is that Qt (the leading C++ library aside from stl) and boost are not compatible. Boost has the more permissive license, but it is its own license, and boost additions can be under their own license. The Qt library is now LGPL (or commercial), and as of Qt5, Qt is divided into even smaller modules.

    I hope the community does not fork again (C++ vs 0x11) with boost vs Qt. I cannot decide whose library should be adopted. But whatever comes to pass, I hope either Qt adopts boost or boost adopts Qt, to prevent further fracturing of C++ community.

    • by Anonymous Coward on Friday March 15, 2013 @10:33AM (#43182837)

      > Now my only problem is that Qt (the leading C++ library aside from stl) and boost are not compatible.

      You write as if you know what you're talking about, but this is flat-out wrong.

      Certainly there are duplicated ways of doing things (improved filesystem support immediately springs to mind), but I've worked on lots of commercial code that uses both libraries, and I've seen similar elsewhere. Generally speaking, using Qt for GUI and other system-type abstractions, and boost for lower-level things such as multi-dimensional arrays, geometry, testing (even smart pointers back in the day). I've written boost AND Qt based code today, for the same project. There is no reason not to use both in any given project.

    • I've worked on projects that have used QT and ones that used Boost, and one giant mess that used both, and so I have to disagree on the hope that they adopt each other.

      Both provide useful tools that don't need to be mixed up. Boost is (afaik) the leading edge for what the next C++ standard will contain. Boost does the crazy things, the good ones get polished and eventually become standard C++.

      I love QT, but I can't imagine it becoming part of the C++ standard. So much overhead for things that you don't alwa

    • We had decent (not perfect) C++ support. Now we go and fragment the industry by inventing a new standard. Code developed to the 0x11 standard won't work on legacy systems with legacy compilers.

      Yeah, and while they're at it they should roll back the c++98 standard too, since a previous employer was stuck with a pre-standards compliant C++ compiler and couldn't use such useless features as the STL. Personally, I think you write code to your requirements. No need to hold the industry back because your system only understands COBOL 74. C++ desperately needed an update. Unfortunately it still needs it, but at least it's incrementally better.

    • by 21mhz ( 443080 )

      I hope the community does not fork again (C++ vs 0x11) with boost vs Qt.

      There is not much of a united community to split along these lines. Pragmatic developers and open source folks tend to use Qt. Wankers who like complexity for complexity's sake, and some developers who build monolithic applications for in-house use may prefer Boost. It's very impractical to use Boost with reusable code, which for the past couple decades means shared libraries. The generative programming wankers who have been shaping the design of C++ never noticed the importance of shared library support. Y

  • If you wait for another decade to come up with an update to the standard, you'll find even more independent libraries and implementations. People need to solve their problems now, they can't wait for somebody else to decide what to include into a standard. Example: a native string object must exist in a language of 21st century, so must a list, a set and a map.

    • oh, and should that string object only support the unicode encodings, or also the extremely popular character encodings that have been in use in countries for decades that all their systems currently use? what if a country has proposed a better unicode set than what the standards committee rammed down their throat?

  • But the day I walked away from C++, Boost and MFC (mutha fucking classes) and joined a C# .Net shop was the happiest day of my life. Slam it all you like, but for UI development, Boost and MFC /Win32 is the worst platform to develop on unless you are a clueless sadomasochist that enjoys pain and suffering.

    • by Kjella ( 173770 )

      But the day I walked away from C++, Boost and MFC (mutha fucking classes) and joined a C# .Net shop was the happiest day of my life. Slam it all you like, but for UI development, Boost and MFC /Win32 is the worst platform to develop on unless you are a clueless sadomasochist that enjoys pain and suffering.

      Don't worry, everybody hates MFC/Win32. Use Qt if you want C++, C# if you don't and I think there's a full dozen more obscure languages/toolkits I'd try before MFC *shudder*.

    • by Anonymous Coward on Friday March 15, 2013 @10:58AM (#43183081)

      "the day I walked away from C++, Boost and MFC"

      I have considered this in detail, and I think I may have spotted a problem with your argument. It can perhaps best be explained with the following example:

      "the day I walked away from peanut butter, jelly, and shit sandwiches"

    • Boost and MFC /Win32

      Agreed. Writing GUIs in C++ isn't that much fun, and GUI logic doesn't need the theoretical performance that C++ could give anyway. Just because C++ is not the right tool for every job does not mean that it is intrinsically bad.

    • As someone who absolutely loves C++ and hacks on it all night and weekends, but writes C# at work, I have to agree with you. It has nothing to do with the language, really, but the libraries.

      C# has far better libraries available than C++ does. I think if C++ got WPF, LINQ, and all the networking libraries like C# has, I'd be just as happy to work in it. Actually, it does have LINQ now.

      • lord no, not the convoluted, bloated, slow mess that is WPF. Even MFC was better for coding GUIs than that. Sure, its more powerful, but the hoops you have to jump through to make it work! A class with a variable and a get/set property for every control you want to get the data from. The IPropertyChangedNotification interface that needs implementing. The binding declarations in XML! Horrible.

        C# has more libraries in one place than C++ has, which makes people think its got more of them. The trouble with C++

        • C++ isn't lacking for libraries, but it is lacking in consistently designed standards-quality libraries. That's all I meant. A UI, I think, shouldn't be built into C++. The majority of the stuff in the .NET framework certainly could and should be.

          Re: off-topic opiniony things:

          WPF is quite pleasant to use after you get the hang of it. Not to imply that you haven't got the hang of it, of course. I've never used MFC (just stuck with plain Win32) so I can't compare to that, but it's by far the best of the UI fr

    • by thoth ( 7907 )

      joined a C# .Net shop was the happiest day of my life. Slam it all you like, but for UI development, Boost and MFC /Win32 is the worst platform to develop on unless you are a clueless sadomasochist that enjoys pain and suffering.

      MFC was pretty nasty, especially back in the late 90's when it was changing around quite a bit. I switched to Windows Forms when it became available and now I'm stuck, kinda used to that and finding it a tough go to use WPF. I can relate to your comment, I like C# and am glad to be away from C++.

    • The day you gave up using the wrong tools for the job on a MS platform was a happy one? What a surprise.

news: gotcha

Working...