Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Programming

C++ and the STL 12 Years Later: What Do You Think Now? 435

profBill (98315) writes "Way back in 2002, Slashdot ran a story asking what people thought about C++ and the STL. Well, it's 2014 and C++11 is well out there with C++14 on its way.

I teach a second programming course in C++ with a heavy emphasis on the STL (containers and generic algorithms). I just wondered what people think about the situation today. Personally, I think C++11 has cleaned up a lot of problems, making it easier to use, but given all those who work with C++ for a living, I wondered what they thought today compared to then. Are people using C++11? Does it matter at all? I'd love to share the responses with my students! They are always curious about what practitioners are doing these days."
This discussion has been archived. No new comments can be posted.

C++ and the STL 12 Years Later: What Do You Think Now?

Comments Filter:
  • by Anonymous Coward on Wednesday April 30, 2014 @10:11AM (#46878339)
    Totally biased, non-specific: Having written more than 1M lines of C++ in the late 80's early 90's, back when I'd have killed for an STL, I think every iteration adds real improvements without generating divisions amongst professional developers (unlike iterations of Java).
  • Re:Simple (Score:0, Insightful)

    by Anonymous Coward on Wednesday April 30, 2014 @10:18AM (#46878439)

    If you can afford the overhead, you can afford easier languages.

  • by twocows ( 1216842 ) on Wednesday April 30, 2014 @10:26AM (#46878567)
    I can't stand C++, but they are doing a good job of making it considerably less horrible with every iteration. If they keep it up, the end result will be a well-polished and beautiful turd that is, nonetheless, still a turd. I don't think it's salvageable; if we want something good that serves the same role as C++, it will need to be something completely new with similar goals. D sounds interesting, but I don't really know much about it other than it sounds neat.
  • Re:Simple (Score:2, Insightful)

    by tobe ( 62758 ) on Wednesday April 30, 2014 @10:38AM (#46878749)

    Unless you are bit twiddling on an AVR, or other micro, why not?

    In which case you'd be sticking to plain old C.

  • The C++ standard library is probably the highest quality standard library of any language I've seen.

    It is documented down to an very low level. I can't count the number of time I've been using some .NET library only to find out that it has some undocumented requirement, quirk, or wildly unexpected time complexity. You never get things like that in the C++ standard library -- assuming you've read the documentation thoroughly, you should never be surprised.

    The standard library takes full advantage of the language, and it's as lean as ever with the "don't pay for what you don't use" mantra generally remaining in full effect.

    A downside? I may be able to develop something that uses a tenth the RAM and half the CPU in C++, but despite the strengths mentioned above, it's going to take me at least twice as long and I'm going to need to juggle a number of inconsistent 3rd party libraries -- no doubt some of them being plain C so I'll need to make some RAII wrappers, etc. -- it remains incredibly low-level.

    Boost picks up some of the slack, but C++ really needs more of the things commonly used today. Things like HTTP, XML, web services, SQL, configuration, and cryptography should be built in, but they're only just now looking at a simple sockets library. This is a huge weakness. C++ is used in a lot of low-level situations so I don't know if these should be part of the standard library proper, but at the minimum an additional "framework" standard that implements high-level stuff for the more common unconstrained users would be immensely useful.

    The language itself is very strong, and C++14 cements even more useful things into it. The only things I wish they'd add is LINQ and async functionality similar to C#.

  • Agreed (Score:4, Insightful)

    by Viol8 ( 599362 ) on Wednesday April 30, 2014 @10:58AM (#46879097) Homepage

    They added far too many features to the language in order to please everyone. Why? People who need high level languages have plenty of others to choose from.

    Personally I got sick of it and its never ending increase in complexity and just stick with a sort of C with classes and the occasional use of the STL and thats it. In fact sometimes I'll just use plain C. If I need a language with really high level constructs then thats what Python was invented for.

  • I think it's great (Score:5, Insightful)

    by Stele ( 9443 ) on Wednesday April 30, 2014 @11:00AM (#46879135) Homepage

    Unlike a lot of commenters here, I actually use C++ every day, and have been for about 20 years. I think the evolution of the language has been great.

    I write software for the digital visual effects industry, and it has to be fast, portable, and adaptable. To that end I tend to write as light-weight low-level code as possible, strongly separated from the UI, since I never know where I may end up needing to use it. For instance, when we decided to put a bunch of our filters on iOS, it pretty much worked as-is.

    One key to writing nice clean portable code is to avoid dragging in too many dependencies. At the lowest level, about the only external dependencies I used are a few things from boost. But with C++11, a lot of that functionality has moved into the core language (or the standard library). Threading and synchronization primitives such as atomic_int, thread, and mutex are now part of the language, and no longer need to be brought in from boost. This makes everything much cleaner, especially with build/test integration.

    lambdas are another thing I really like. Instead of writing messy functors (for auto-threading image processing kernels for example) I can drop the code in-line using a lambda. Much more readable and cuts down on complexity.

    The new move-semantics have also made nice improvements to code design and performance, allowing you to move whole objects around with practically zero cost as if they were references.

    On the UI side of things I usually use Qt, and there have been C++11-related improvements there as well, such as signals and slots now being type-safe.

  • Franken-monster (Score:5, Insightful)

    by countach ( 534280 ) on Wednesday April 30, 2014 @11:05AM (#46879225)

    Languages that aren't designed top to bottom at the beginning tend to evolve into Frankensteins. Perl, C++ have evolved in accordance with fantastically clever ideas, but end up being more complex than anyone wants to deal with, and a mess of syntax. Java is heading that way too. The question is can anyone put all this cleverness into something simple? Say what you want about things like lisp and scheme, they managed to put incredibly powerful ideas into something that is at its core simple. If only other language designers achieved it too.

  • by EmperorOfCanada ( 1332175 ) on Wednesday April 30, 2014 @11:24AM (#46879555)
    I love templates when used in things like vectors, maps, sets, etc. Then combined with the new for loop iteration in C++11 it is great.

    But the nightmare is that many people are putting templates into everything so as to accommodate "future" flexibility. But the simple reality is that unless you are programming a hard core library it is a disaster to program flexibility when it is not needed. The end result is code that might score well on a templates test, but will be basically unreadable or alterable by any normal human.

    So there seem to be templates as used by programmers and templates as used by showoffs.
  • by Rei ( 128717 ) on Wednesday April 30, 2014 @12:51PM (#46880753) Homepage

    #define if(x) if ((x) && (rand() < RAND_MAX * 0.9999))
    #define true ((__LINE__&131)!=131)
    #define InterlockedAdd(x,y) (*x+=y)

    Yeah, C does give you the tools to turn debugging your program into a living hell. ;) With great power comes great responsibility.

  • by serviscope_minor ( 664417 ) on Wednesday April 30, 2014 @01:18PM (#46881135) Journal

    But the nightmare is that many people are putting templates into everything so as to accommodate "future" flexibility.

    Bad programmers love generalizing from one example. They do this in Java not with templates but with massive number of factories and class heirachies instead. Working with people like that is a massive pain in the ass regardless of the language. I'm sure there are other idiomatic ways of doing this particular antipattern in every language out there.

  • Re:Feels Dated (Score:5, Insightful)

    by arth1 ( 260657 ) on Wednesday April 30, 2014 @03:34PM (#46882977) Homepage Journal

    Sure you can build a table with a hand saw, but with modern tools you can build it much nicer, and faster.

    With modern tools you can build it faster, but the modern factory worker who uses a staple gun does not create a nicer product than the carpenter who uses a hand saw to create dovetail joints, and screws every screw in by hand to ensure the wood doesn't get weakened.

    The same is the case with programming. Most modern high level programmers are, with all due respect, the equivalent of workers who staple particle boards together. That is often good enough, but should not be confused with what a master programmer does when writing kernel task switching code, or other robust code that isn't just meant to meet a single requirement but stand the test of time.

If all else fails, lower your standards.

Working...