Slashdot Mirror


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

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."

435 comments

  1. Feels Dated by Anonymous Coward · · Score: 5, Interesting

    This will probably come off as a troll, but it's really not intended to be. And keep in mind this is just my experience in my domain with the type of projects I've worked with. There's lots of different domains/projects sets where this wouldn't apply.

    I used to love c++ and berade people who used wimp languages like Java. These days I mainly use java, and when I do have to use c++, it feels painfully dated.

    At to C++11, while it added some useful stuff, in general it feels like it's just flailing while trying to bring in some of the language features of newer/more modern languages. The new concurrency stuff in particular is just plain unseemly.

    Also, a relatively minor but annoying and long-standing problem with doing anything non-trivial in c++ is the lack of consistency between 3rd party libraries. Java has spoiled me into expecting everything to adhere to one convention, but with a c++ project as soon as you've got more than a few external libraries, you end up with a huge mess of code that doesn't mix properly, and writing adapters for everything to get that consistency is just insane.

    Long rant short: I'm finding myself using c++ now mainly for:
    - small bits of functionality to be used via JNI
    - small stuff mainly focused around one library/task (Qt, pqxx, whatever)

    Doing anything large and complex with c++ these days just doesn't appeal to me any more. I can build it much faster with java, it'll be more maintainable, and performance wise it's fine for what I do.

    Also: floating bottom popup ads.. really dice? You just fell off one mans adblock whitelist.

    1. Re:Feels Dated by tree_frog · · Score: 1

      Absolutely agree - but in my case my preferred poison is Ruby rather than Java. I am using it on embedded systems because these days, it is fast enough on a modern embedded controller of the RPi variety.

    2. Re:Feels Dated by JustShootMe · · Score: 4, Interesting

      Ruby makes sysadmins cry. I tried updating a legacy server yesterday that is running a ruby app. After two hours of trying to make it work, I gave up.

      --
      For linux tips: http://www.linuxtipsblog.com
    3. Re:Feels Dated by kodomo · · Score: 1

      It would be nice to see a kernel in java

    4. Re:Feels Dated by Anonymous Coward · · Score: 0

      As what I suppose would be called a devops person, this is actually quite true. The best way to hand things these days is pretty much do the server and the ruby separately: use rbenv to install ruby from source and bundler to install all the gems. Do not install ruby or any gems from the OS packages. This way of doing things really does make things a whole lot easier when updating stuff.

    5. Re:Feels Dated by Anonymous Coward · · Score: 0

      Ruby's a complete disaster from an operations perspective.

    6. Re:Feels Dated by Anonymous Coward · · Score: 0

      Just out of curiosity, because i hear the "small bits via JNI" quite often: can you give me a (relatively) detailed example for a "bit" that you call via JNI ? I am really interested because i do a lot of development and have rarely seen these often quoted "bits" that would be worth the effort and that would actually profit.

    7. Re:Feels Dated by Anonymous Coward · · Score: 0

      In my case I can't get used to STL algorithms (not very readable to me) and I find template programming painful. But I don't find templated dated, at least because java has something very similar (generics). What in particular does feel dated to you in the standard?

    8. Re:Feels Dated by Keruo · · Score: 2

      Go and have a look at one then.
      First one that came up with search results.

      --
      There are no atheists when recovering from tape backup.
    9. Re:Feels Dated by Noah+Haders · · Score: 1
    10. Re:Feels Dated by Anrego · · Score: 1

      Two common ones I've seen:

      - Talking to hardware via serial
      - Using some 3'rd party communication library/API which doesn't provide it's own binding (which itself would usually be JNI) or native implementation

    11. Re:Feels Dated by Anonymous Coward · · Score: 1

      I very seldom use any C++ library but Qt. Qt offers pretty much everything needed for developing a big application with lots of functionality, in that sense, I've always felt that Qt made C++ as usable as Java.

      Now and then, I have to use another C++ library, like OpenColorIO, and that's just as much a culture shock as using a C library for me.

    12. Re:Feels Dated by Vanders · · Score: 5, Interesting

      I'm one of these irritating DevOps types.

      The Dev side of me loves Ruby. It's a nice language, it's powerful, the standard library is nicely complete and there are Gems for pretty much everything I could ever need.

      The Ops side of me hates Ruby. Managing all those Gems on any given server is just horrible, rbenv & rvm need to die in a fire, there are a apparently one hundred different ways to run an application and proxy requests to it, and of courses Gems exist outside of the system package manager and that's always bad.

    13. Re:Feels Dated by Anonymous Coward · · Score: 0

      - The need for header files
      - The shittiness of build systems and general ad-hoc way of dealing with dependencies (where's my ivy, maven, gradle, etc equivilant)
      - A lot of the object oriented stuff feels old fashion. Take threads for example: in a language like java you have a base Thread object that you extend and provide your specific derived logic, creating a WhateverThread. In C++11, you create a thread object with a reference to a callback. Yes you've got a thread "object" and yes it's trivial to create a WhateverThread class that wraps this up, but it still feels like a dated way of doing things, really little more than a wrapper around the way you did it with pthread (and yes, I know Java also supports creating a Thread by passing a reference to a callback, the difference is that callback in java is an object that can be pre-constructed and have state, whereas in C++11 it's just a function).

    14. Re:Feels Dated by Anonymous Coward · · Score: 0

      It would be nice to see a kernel in java

      C++ C

      The Linux kernel is written in C not C++ (Ask Linus why, he seems to think C++ is s***.) Not that you couldn't write a Kernel in C++, but then you could write a kernel in just about anything. So what is your point. A language is better because you can write a kernel in it.

      Languages are tools to get a job done. Sure you can build a table with a hand saw, but with modern tools you can build it much nicer, and faster.

      I write a good deal of my small tools in Bash if it gets bigger or needs String manipulation, parsing, and hash tables, I use PERL. When I wrote a tool for our Client Support team, I used Java since all of our development is in Java, so all of our developers know that and could support it. If I needed to write a plugin for our database engine, I would use C.

      I haven't used C++, but I have used Objective-C, when I developed for the Next. So, I don't know when I would use C++ over C, or Objective-C. I am sure C++ is useful. I just haven't been in a situation to use it.

    15. Re:Feels Dated by Anonymous Coward · · Score: 0

      C++ doesn't equal C (somehow not equal sign got eaten. )

    16. Re:Feels Dated by Cornelius+the+Great · · Score: 2

      The ! negates the = that came after it. Duh. ;)

      --
      Sigs are for losers
    17. Re:Feels Dated by Rei · · Score: 3, Interesting

      Funny, that's precisely how I feel when I have to use Java - "Where's capability X? Oh, dang, you don't have it. Wait, where's capability Y? Ugh, you don't have that either? Wait, I need to go through all this mess to do Z? Seriously?". Feels like pulling teeth.

      I guess it's whatever you're used to.

      I really love C++11. It's not perfect, mind you. The last standards-problem I ran into was that you can't template a class over a constant floating point value, only integer/boolean values... it was designed because a programmer might accidentally compile huge numbers of classes via template metaprogramming or the like when they only wanted one due to the imprecision of floating point values, but 1) how often are people seriously going to template metaprogram over a floating point value like that, and 2) who knows template metaprogramming but is unaware of the imprecision of floating point values?

      That said, there's tons of great new stuff in the standard that I just love. Just to pick one: I love how the combination of lambdas and the new threading utilities makes it trivial to inline-thread any task, no matter how mundane. My favorite example is a single-line asynchronous packet handler (assuming you have a packet-handling factory class and a data read routine onhand) - repeatedly reads data, generates a smart pointer to a handler and runs it in its own thread, wherein it deletes itself when the thread expires. Okay, two lines if you want the code cleaner and you put the while loop on its own line, but still...

      --
      When was the last time you ran anywhere? I mean with your own legs, not by pressing 'X'?
    18. Re:Feels Dated by delt0r · · Score: 1

      Ask Linus why, he seems to think C++ is s***.

      His specific quote was that he thinks C++ programmers are %^$@#$@ @#@# ^&*@#!@ and didn't want them anywhere near the kernel. He is Finish after all.

      --
      If information wants to be free, why does my internet connection cost so much?
    19. Re:Feels Dated by Rei · · Score: 2

      You're forgetting that C++11 also introduces lambdas, which basically means you can inline-thread any command with thread([](){/*your code here*/}).detach(); All too easy. If you'd rather, you can keep the return value to join it later. Or you can use a future to make it even easier.

      Why are you complaining about Make as if that's part of the language and the only way to build C++? (*boggle*)

      --
      When was the last time you ran anywhere? I mean with your own legs, not by pressing 'X'?
    20. Re:Feels Dated by Anonymous Coward · · Score: 0

      which basically means you can inline-thread any command with thread([](){/*your code here*/}).detach();

      Same problem, different wrapper. Your lambda function can't easily provide external access/manipulation of state any more than a callback function can. You end up having to pass a bunch of references (or have them directly accessible) into the function, which wile it works, feels very old fashioned (which again, was the original complaint).

      Why are you complaining about Make as if that's part of the language and the only way to build C++? (*boggle*)

      The experience of using a language (and the reasons a language is chosen) extend way beyond the language itself. The tool stack around c++ is totally relevant to a discussion on how using c++ feels. The amount of really good dependency management, build, test, code analysis, and documentation tools around Java is definitely one of it's strong points, and an area where c++ is sorely lacking (we've got some of it covered, but a lot not).

      I've yet to find a build system for c++ that didn't totally suck, and they all feel painfully dated when compared to what's out there for java.

    21. Re:Feels Dated by Rei · · Score: 1

      Your lambda function can't easily provide external access/manipulation of state any more than a callback function can.

      What do you mean? Are you talking about "[&](){ /* your code here */ }"? (& = capture all variables by reference)

      --
      When was the last time you ran anywhere? I mean with your own legs, not by pressing 'X'?
    22. Re: Feels Dated by Threni · · Score: 1

      What language-preferably something new rather than dated, because new is always better-do you suggest be used for operating systems, games, simulations and other large/complex tasks? Not all Slashdot readers are html hairdressers, you know...

    23. Re:Feels Dated by coolsnowmen · · Score: 1

      in general I agree. For us, we followed fedora's lead and wrapped up gem's we needed into rpms so that they are maintained by the system package manager (yum), and are still visible to any ruby code.

    24. Re:Feels Dated by Anonymous Coward · · Score: 0

      Consider (rough pseudocode):

      class ProcessingThread extends Thread
      {
          BlockingQueue aBlockingQueue;

          public void run()
          {
              while (Thing aThing = aBlockingQueue.take())
              {
                  aThing.doSomething();
              }
          }

          public addAThingToQueue(Thing aThing)
          {
              aBlockingQueue.put(aThing);
          }
      }

      usage:

      ProcessingThread processingThread;
      processingThread.start();
      processingThread.addAThingToQueue(someThingToProcess);

      With C++11, your BlockingQueue would have to be outside ProcessingThread and passed into it via reference (or accessible via a singleton). To get the warm fuzzy "all in one unit" feeling you have to have ProcessingThread create it's own internal thread to an internal callback. Again, not an insurmountable problem, and this is a really trivial example, but just something that feels.. old school.

    25. Re: Feels Dated by Anonymous Coward · · Score: 0

      > whereas in C++11 it's just a function

      Wrong. It is a function object (of which a function pointer is a specific case). Even a lambda, in C++, is not a function but rather a function object. Function objects can have state.

    26. Re:Feels Dated by Anonymous Coward · · Score: 0

      I'm a C++ progammer who just recently learned Java and Objective-C and I must disagree with your assessment. Java (at least the version used in Android programming) feels like it was designed in the 90s and hasn't progressed since. Objective-C feels like it was designed in the 80s and had a few useful features tacked on since. C++ has certainly evolved to fit modern needs, although I'm sure its complexity could be reduced if it were designed from scratch.

    27. Re:Feels Dated by arth1 · · Score: 4, Insightful

      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.

    28. Re:Feels Dated by HiThere · · Score: 3, Interesting

      Well, I'm totally developer, and I *don't* like Ruby. Partially because it's too slow, but mainly because it doesn't support utf-8 (or actually any unicode) well. That needs a gem. I really like Vala even though I find it unusable. (Poor documentation and incomprehensible error messages.) It seems to be aimed only at people who are already experienced in GObject programming...which is a weird target audience for that kind of language.

      I *don't* like Java, though that's what I'm using at the moment. I prefer Python and D http://dlang.org/index.html . But Python doesn't handle multi-processing well, and D is missing too many libraries. (Outside of the library problem, D is the best language I've encountered.)

      My main gripe with C and C++ is the horrible way that they handle Unicode. And it's not as if they didn't have alternatives available before they even started to deal with it. (C has the argument of "maintaining simplicity" to justify shoving that off to a non-standard library, and glibc does a reasonable job. C++ doesn't have that argument.)

      A secondary grip with C/C++ is poor multi-processing. This isn't quite fair, though, because I'd already decided that they were unusable due to the unicode handling issue. (I also don't like Java's choice of utf-16. I much prefer either utf-8 or utf-32. utf-16 seems to inherit the problems of both of the other choices.) Since I'd already decided that they weren't acceptable choices I didn't seriously look into their methods of multi-processing.

      Note that for BOTH unicode handling and multi-processing I would prefer D over any other choice I've seen. But the lack of libraries counts as a heavy enough strike against it that I'm using Java..

      FWIW, I suspect that both the Dev and the Op sides of you would like D. (Digital Mars D)

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    29. Re:Feels Dated by Anonymous Coward · · Score: 3, Interesting

      Disclaimer: I'm a game developer with more than 15 years of programming experience in various fields, most of the efficiency-oriented, so my perspective is skewed towards that segment of the industry.

        The instant I was exposed to C, it was love at first sight. The control, the zero-overhead philosophy, the power... It became my language of choice then and there, and C++ quickly followed. I don't understand all the bitching and moaning about C++ (as opposed to C,) because C is (almost) a proper subset of C++, and you just don't have to use what you don't know or like or are comfortable with. I've been using C++ for about 12-13 years now, along with many others, including Perl, Python, JavaScript, C#, Lua, etc., but I have never felt any of them were as expressive or as powerful as C++, or gave me the same level of control. Sure, each of these other languages is good for many tasks (mostly due to the domain-specific libraries/frameworks available for them,) but I've never been convinced that using any other language, I could accomplish more than half of what I do on a day to day basis with C++.

      And C++11 was a fantastic step forward. I just naturally started using most of its new features, from auto and range-based loops to r-value references and moving to variadic templates and lambdas. I didn't use any of these just to have used them; it happened organically and naturally. And as a result, my code got more beautiful and more powerful and more efficient. Over the past few years, while compiler and library owners were in the process of implementing and adopting C++11, I've found myself using (or wishing for) still-unsupported features on many occasions, and going back to the old methods have always been a painful and jarring experience.

      A non-issue for me is the complexity of the language. I think of myself as the kind of C++ programmer that knows about 90% of the language and can put that percentage to use. I may not be comfortable or proficient with all of that 90%; I certainly couldn't have written something like Boost.Lambda or Boost.Spirit from scratch, but I can read and understand (most of) them. The way I see it, the complexity is just the cost that comes with all that power. Could it have been simpler without any sacrifice? Most probably, but not significantly simpler. And it's not at all clear to me how you can accomplish that. All of us programmers have seen many many attempts at simplification, at "one size fits all", and none of them work.

      And knowing all those complex and complicated stuff is totally worth it. I think I know 90% of C++ and I use all of that; with varying frequencies to be sure, but I do employ all I know in my everyday code. So, I pity the programmers that limit themselves in their knowledge of the tools at their disposal. I cannot understand how one can know "just enough" of a programming system; because every little bit you don't know will impact your code for the worse.

      I grant you that the C++ space has other problems. Very serious one. But they are not fatal. IMHO, the most important problem C++ has today is incompatible libraries. How many libraries implement their own containers, strings, threads, I/O, timers, etc.? In an asynchronous context, how would you wait on two incompatible mutex objects from different libraries at the same time? How much of your process' time is spent converting strings or copying buffers between incompatible frameworks? This has come about because of the C++ standard library lacking many essential features, and because of bad implementations and compilers. But all of that is improving. The size of the standard library is growing with all the satellite working groups around the standardization committee. The compiler and standard library implementers are delivering and fixing new (standard) features faster than ever (influenced greatly by Clang and the new blood it brought to this sector.)

      In short, C++ is great and it's getting better than ever, faster than ever.

    30. Re:Feels Dated by StripedCow · · Score: 1

      You can't even do this in C++11:


      auto factorial = [&factorial](int x) -> int
      {
              if(x == 0)
                      return 1;
              else
                      return x*factorial(x-1);
      };

      --
      If Pandora's box is destined to be opened, *I* want to be the one to open it.
    31. Re:Feels Dated by Anonymous Coward · · Score: 0

      But to be fair we all know that Linus Torvalds is a fucking arsehole of the highest degree.

    32. Re:Feels Dated by epyT-R · · Score: 2

      So what exactly is dated about it?

    33. Re:Feels Dated by epyT-R · · Score: 2

      ruby? on an 'embedded' platform? Your customers must not mind paying for 50x the hardware that's actually needed.

    34. Re:Feels Dated by Darinbob · · Score: 1

      C/C++ were developedbefore unicode. And unfortunately, C++ took a misguided step and went with wide chars instead of multibyte chars which has tainted it for some time since, but to be fair there were a lot of people who took a wrong turn and decided 16-bit chars were the way to go and thought multibyte was complicated. About the only time you need to convert from a well designed multibyte to wide characters is at the very end when you stick the character into a gui, the rest of the time you are comparing/copying bytes instead of characters. So you can do almost everything with mblen() and family and get more performance and use less memory, since utf-8 just works (and would have been the perfect choice for storing file names in a filesystem, had microsoft been more competent).

      If someone does want wide characters, then 16 bits is already too small to represent commonly used languages. So utf-16 is the worst of both worlds as you say. But standards never become developed through a logical review of problems and solutions, but from players with lots of money fighting each other.

      (and unicode is still controversial for some, especially with CJK issues, but since it is now a part of so many standards most people just accept it pragmatically)

    35. Re:Feels Dated by Darinbob · · Score: 2

      The one thing I notice is that C++ greatly changed with STL. Much of the community moved away from using C++ as an object oriented language and instead use it as a generics oriented one. Even without using STL, templates have become vastly more common to use, and the templates being used are much larger. It feels odd because many of those collection libraries that were in use before STL were actually more efficient in many ways. Today C++ programs are bloated and they don't need to be. It's no longer the language used as a fast and efficient language (even though it's seen that way from a Java perspective maybe).

      C++ compilers/linkers still have not really figured out how to reduce that bloat that comes from using templates too much, they can not detect when two copies of a template are essentially identical and should be merged.

      Another factor I've seen since STL was introduced is with programmers who can not do anything at all without using STL. It is their one tool in the toolbox. For instance, std::map is greatly overused in many cases where it is inappropriate where even a vector will do the same job (it's like they can't see the difference between vector and map, or they've previously come from a scripting language background). At a step up, gone is any decision making about whether to use a hash table versus tree or some other data structure which is more appropriate to the problem, when you can just use map and be done.

    36. Re:Feels Dated by Anonymous Coward · · Score: 0

      Unicode is for suckers anyway! everyone knows the language of the internet is english!

    37. Re:Feels Dated by Anonymous Coward · · Score: 0

      C++ is a language for software which needs low level optimizations and high level infrastructure. Why people continue to argue against it because it's not suitable for writing GUI applications who spend 99% of their time in an idle loop is beyond me.

    38. Re:Feels Dated by CadentOrange · · Score: 1

      They're probably happier paying 50x more for hardware than 200x more for development.

    39. Re:Feels Dated by Rei · · Score: 2

      Why on earth would a person *want* to have to go through all that mess just to launch a thread? *boggle* And what on earth is wrong with defining a queue on its own and passing by reference (or using it as global / namespace global if you'd rather)? Why should a queue be part of a thread object? It's not a thread, it's a queue.

      Let the user put objects wherever they want, don't force them to extend a bloody class every time they want to thread something. : THAT feels old-school. If a person has to go through that much work every time they want to thread everything, you're inherently discouraging threading, which is a huge problem on today's architectures where increased computing power is increasingly achieved by increasing the number of cores.


      BlockingQueue aBlockingQueue; // Put this in whatever scope you want
      thread([&](){ while (true) aBlockingQueue.take().doSomething(); }).detach(); // Insert newlines as per your style perferences.
      aBlockingQueue.addAThingToQueue(someThingToProcess); // Do this whenever you want

      Which version do you think is more conductive to people using threading more often? Be honest with yourself. Heck, it's so simple in C++11 that if would be hardly harder to do:


      BlockingQueue aBlockingQueue; // Put this in whatever scope you want
      thread([&](){ while (true) { auto thing = aBlockingQueue.take(); thread([&](){ thing.doSomething(); } } }).detach(); // Insert newlines as per your style perferences.
      aBlockingQueue.addAThingToQueue(someThingToProcess); // Do this whenever you want

      Assuming Thing is some sort of smart pointer, that further sets the processing of each doSomething() into its own thread, and then when it's done, thing gets deleted. In Java as per your example you'd have to create a whole new bloody class to do that - talk about backwards!

      --
      When was the last time you ran anywhere? I mean with your own legs, not by pressing 'X'?
    40. Re: Feels Dated by dominic.amann · · Score: 1

      I just realized why I didn't understand everyone's unicode complaint. It has nothing to do with c++ the language. You guys must all be coding for microsoft and its native 16 bit char encoding. As for elegant, powerful, consistent libraries, boost handles almost everything.

    41. Re:Feels Dated by Jeremi · · Score: 1

      you're inherently discouraging threading, which is a huge problem

      On the other hand, discouraging threading may be a good thing. It's pretty common on e.g. StackOverflow to see new C++ programmers (usually coming in from Java-land) trying to use threads to solve every problem, and ending up with a race/deadlock-ridden mess that they are unable to stabilize or even understand.

      Personally I think threads to programming what morphine is to medicine -- powerful and useful when used correctly, but also extremely dangerous if you don't know exactly what you're doing, and generally not something you want to use on a whim. Perhaps the language should reflect that.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    42. Re:Feels Dated by godefroi · · Score: 1

      The way I understand it is that UCS-2 (not UTF-16, because UTF-16 supports surrogate pairs) gives significant performance advantages for operations like substring(). That's why lots of platforms use it internally (.NET, Java, others I'm sure).

      --
      Karma: Poor (Mostly affected by lame karma-joke sigs)
    43. Re: Feels Dated by HiThere · · Score: 1

      I don't use MS, but most libraries are designed with it in mind. As I said, glibc does a reasonable job, it's just another "non-standard library dependency" that I would prefer to avoid.

      My real preference is utf-8, which both D and Vala handle quite well. So does Python3, but it hides what it's doing from the programmer. utf-32 is an acceptable second choice. It makes some things easier at the cost of using considerably more RAM. Utf-16 (or, as someone said, UCCS-2 [if I've got that right]) is not a reasonable choice. It was a reasonable choice back when int-s were often 16-bits long, because it fit in with the existing CPUs.

      For most of what I'm doing anything beyond ASCII-7 is excessive, but I also need to handle the occasional Greek letter, of Sanscrit char. So utf-8 works, and utf-32 works. Wide (64-bit) chars will do the job with simpler code, but it wastes a lot of RAM. Utf-16 doesn't waste quite as much RAM, but it code doesn't get ANY simpler, so it's jusst an lousy compromise. But that's what Java offers. And I'm putting up with it because the C++ way of handling unicode character strings and multi-processing is so much worse. (But I *do* wish that Vala would become usable. It seems to have just stalled at becoming more usable and better documented.)

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    44. Re:Feels Dated by Darinbob · · Score: 1

      Substring searches are very efficient using standard C functions on UTF-8 strings (and many other well designed multibyte formats). Ie, first byte of a multibyte character never has the high bit set so you will never accidentally find a substring that starts in the middle of a character. Granted there are a few multibyte systems that were not designed to avoid these problems.

      For very long strings composed mostly of non-ASCII characters then the 16-bit substring match may be faster. But for most cases in western languages the byte searching is faster since most characters are single byte in UTF-8.

    45. Re:Feels Dated by pthisis · · Score: 1

      But Python doesn't handle multi-processing well

      Python's great for multi-processing, much better than Java (which has no built-in solution for multiple processes/tasks, requiring you to throw out the benefits of protected memory or resort to hacky multiple JVM solutions with home-brewed synchronization primitives in order to take advantage of multiple CPUs).

      Java's better for multi-threading, but that's usually a poor approach to multi-processing and in the real world the GIL problems with Python are often (but not always) overstated--e.g. the GIL is released by C extensions, so if you're using numpy or PIL or something then it's a non-issue much of the time. And Python has excellent support for fork-without-exec, shared memory maps, and other things that are important to good multiprocessing.

      --
      rage, rage against the dying of the light
    46. Re:Feels Dated by Pseudonym · · Score: 1

      The syntax being built on top of C is pretty dated.

      (I love C++, but I think I really want to program in D.)

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    47. Re: Feels Dated by excatholica · · Score: 1

      I had to write JNI code to use Windows API for registry and Service Control Manager directly from a Java program. Not the only way to do it especially in these days of Powershell but worked a treat at the time

    48. Re:Feels Dated by godefroi · · Score: 1

      "Very efficient" is still much less efficient, because on 16-bit characters, you simply split at char_count * 2 bytes, where with UTF-8, you have to examine every byte up to char_count to see if any of them are part of a surrogate pair.

      --
      Karma: Poor (Mostly affected by lame karma-joke sigs)
    49. Re:Feels Dated by Jorl17 · · Score: 1

      He means he wants to be able to pass an instance, an isolated component which can not only be spawned as part of a thread, but keep an internal state during program existance, and across different thread spawnings. And he doesn't want to do it by using variables defined in another, outside scope (functions, globals...).

      --
      Have you heard about SoylentNews?
    50. Re:Feels Dated by epine · · Score: 1

      The last standards-problem I ran into was that you can't template a class over a constant floating point value, only integer/boolean values

      News update from planet math. You can template a class over an integer pair which provides a dense set over the Reals known as the Rationals.

      If one couldn't do this, the argument at the standardization round table would have been a lot different.

    51. Re:Feels Dated by Darinbob · · Score: 1

      My point is that you don't need to see if they're a part of a pair with UTF-8. The substring being searched for will always start with the first byte of a multibyte character, never with the second or third byte. And the first byte will never match a second or third byte because of the encoding (first byte of a character always starts with binary 0, 110, 1110, etc, whereas subsequent bytes of a character must always start with binary 10). Thus the C strstr() function will work even with UTF-8 if the strings always start at a character boundary.

    52. Re:Feels Dated by Extide · · Score: 1

      He was talking about an R-Pi which only BARELY qualifies as an embedded setup. Tyically I am thinking AVR, Cortex-M, PIC, etc when I hear 'Embedded."

      --
      Technophile
    53. Re:Feels Dated by Anrego · · Score: 1

      It's more about encapsulation. The given example is too trivial to really demonstrate this, but it comes into play when you've got a thread with many states/queues/etc that you don't want to just give direct access to (maybe to enforce specific usage, maybe for internal thread safety, whatever) or multiple instances of a thread. Obviously both approaches can work just fine and be designed around, but I've always found the java way felt more object oriented (and not just because it involves defining more classes).

      Personally I wrote a very trivial wrapper around pthreads that emulates the "java way" of doing threads and have been using it happily for years. I was kinda disappointed c++11 didn't at least provide the option of doing it java style, but at most it's an extremely slight inconvenience.

      Speaking of blocking queues though, std::condition_variable and friends ... yikes!

    54. Re:Feels Dated by HiThere · · Score: 1

      Now *that's* very interesting. Certainly it's a point of view I've never heard before (which doesn't mean it's wrong). Any place I could look this up? I've considered Pyro (though not recently), but when I looked it didn't seem a good fit. It appears that it would require a large hose of Python interpreters running at the same time, and that's a poor fit without unlimited RAM. What alternative approaches are there? (I describe the application a bit below.)

      I've been having a lot of trouble trying to design the thread management for my application, largely because it uses a different model of parallelism than is common for things like web servers. (It's closer to a graph algorithm.) So for Python I wouldn't be able to use a server / process, which made me think that the GIL *would* be a major problem. I'm trying to build something that's based on a bunch of isolated cell with quite limited channels of communication between them. Each particular "cell" is a collection of class instances that are isolated from all external interaction except for a few channels of communication (implemented through method calls). Synchronizaation is a problem. So is persistance, as each cell, after being active for awhile, will go dormant, and eventually be rolled out to a database, to await being re-invoked.
      Note that this isn't a highly numeric application, and also not particularly graphical, so neither numpy nor PIL are reasonable candidates for inclusion, and also, for obvious reasons, accessed to the database will be minimized as much as possible.

      Perhaps I should look into Go again, but problems with documenting the code (and the documentation of existing code) have previously convinced me that it would be a poor choice.

      OTOH, because threads are a limited resource compared to "cells", I can't depend on thread isolation for memory protection. So it's not clear that a threading model is a good choice. I't need to use thread pools, and that means that I'd need to depend on other means of isolation in any event. ("Cells" will need to go in and out of activity fairly quickly.) And documentation is quite important, because the system is going to be much too large to hold in my head. (For Python this means DOxygen, as Sphinx is terrible. Everything ends up out of date as things keep getting redesigned. I'm after developer documentation, not end-user documentation, for which Sphinx is reasonable. Too bad Epydoc doesn't work with Python3. It's much better for Python than is DOxygen.)

      FWIW, I've even considered using Ada. It has some constructs that seem ideally designed for my purposes. But it's too difficult to use variable length constructs, documenting code is terrible, and the user community seems to be dying. It also has a difficult form of garbage collection, that appears to be a poor fit to this application.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    55. Re:Feels Dated by smithmc · · Score: 1

      Then it must be a very low-volume platform.

      --
      Downmodding is the refuge of the weak. Don't downmod, make a better argument!
    56. Re:Feels Dated by Anonymous Coward · · Score: 0

      I didn't know Ruby doesn't do UNICODE. I'm a pythonista. I haven't touched Java in many years now. Are you and parents doing consumer software development? My python is purely for web and for little tools that make my life easier. Python is my perl. I'd love to be using pure C++ but Cocoa is easier when you do Objective C. .NET on Windows is much better with C# for me. The only Java apps I've every really used, discounting web apps, were Minecraft and that Java version of Word Perfect from many years ago. That cemented in me the idea that anything done in Java was going to be slow in every way imaginable except prototyping. I think C is one of the ugliest languages I've ever used along with PHP. I've always found it much harder to follow another person's C code.

      I know the mantra is that we should know multiple languages and use the best one for each situation, but I fantasize about using a one true language and being so good at it that I can easily do anything with it in little time. C++ always seemed like it was just that. It has the portability, the libraries, the speed. But I just feel constantly lured away from it by other languages, particularly the first class status that languages like C# and Objective C have on certain platforms.

    57. Re:Feels Dated by ultranova · · Score: 1

      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.

      Yes. And you know what? It doesn't matter. The factory-made table is good enough, while hand-made one may be better or may be worse, but is far more expensive in either case.

      There's a reason why factories replaced artisans in the real world.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    58. Re:Feels Dated by arth1 · · Score: 1

      Yes. And you know what? It doesn't matter. The factory-made table is good enough

      Surely that depends on your definition of "good enough".
      It could be good enough for a consumerist who thinks Ikea is the greatest, but it won't be good enough for someone who believes in being able to maintain instead of replace.

      In any case, the guy with a staple gun isn't a furniture carpenter, and to call him such is an insult to the trade.

    59. Re:Feels Dated by godefroi · · Score: 1

      strstr() is fine, yes, but what about strncpy()?

      --
      Karma: Poor (Mostly affected by lame karma-joke sigs)
    60. Re:Feels Dated by HiThere · · Score: 1

      After checking some more:
      With Python3 multiprocessing I'd need to use managers, and the documentation specifically says that managers are slow compared to normal Python code. Python is already around a 3-10 times speed penalty when compared to Java, so that sounds unacceptably poor.
      FWIW, threading does have penalties associated with a shared RAM space, which is why the synchronization problems. OTOH, if I need to communicate lots of data between separately running tasks, ALL I need is synchronization. With multiprocessing there needs to be separate memory spaces that are kept in sync, and probably separate virtual machines (though that is only hinted at with the comment that the different processes can be running on separate machines).

      No language seems to have a multi-thread/process system that is well adapted to the thing I'm trying to write, as I need async execution of things with read access to lots of data, and write access to their own data. In Java I can manage this by making the writable data private to the class, and access from outside only via synchronized getter functions. This is possible in Python3, but seems more difficult. I also looked into Go, but that appears too undeveloped. (See "Concurrency is not Parallelism" and then look up gomaxprocs, especially the warnings associated with its use.) Go looks as if it could be developed into a much better language for multiprocessing than either Java or Python, but it doesn't appear to be there yet.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    61. Re:Feels Dated by pthisis · · Score: 1

      I'd need to know more about your app to make a real recommendation, but in general for multiprocessing I'd use fork without exec to spawn new processes; they will share memory in a copy-on-write manner, so the python interpreter itself and other read/execute only memory will be shared between all processes.

      There are numerous approaches to data sharing--sockets/pipes for streaming data and memory-maps for shared memory segments (memory maps are generally preferrable to SysV shm segments, IMO), and either token passing via pipes or something like multiprocessing.Lock for synchronization.

      Your cells may want an event-driven state machine model. It's tough to say without knowing more about the app.

      --
      rage, rage against the dying of the light
    62. Re:Feels Dated by pthisis · · Score: 1

      BTW the basic architecture choices are similar across most languages; whether it's C or Python or Lisp or C++ or whatever, you're looking at a handful of common primitives for synchronization and data sharing, often with thin language-specific wrappers around them.

      The most common times that there's a major difference is when either in a highly functional language designed around concurrency (e.g. erlang) or a language that isolates you so much from the environment that you can't easily use common primitives (Java's inability to get to multiprocess calls is the most obvious example).

      --
      rage, rage against the dying of the light
    63. Re:Feels Dated by pthisis · · Score: 1

      Go doesn't have support for fork without exec, or at least didn't last time I looked at it.

      I need async execution of things with read access to lots of data, and write access to their own data.

      This sounds like shared memory segments to me. You can enforce memory protection by having separate mappings per process that are only writeable by the owner, with the processes running as separate users. That's safest but requires separate users and can be a headache for some tasks. Alternatively you could rely on the open/map calls being right and use read-only mode there but run as one user (you'd still protect against random pointer bugs, mistakes about which data structures you're writing into, etc as long as the open calls were correct).

      ALL I need is synchronization

      What kind of synchronization? What are your performance requirements? You may want want to consider simple mutexes, spinlocks, token passing, or read-copy-update depending on what you're doing.

      --
      rage, rage against the dying of the light
    64. Re:Feels Dated by HiThere · · Score: 1

      Well, the basic architecture is that there is a pair of synchronized hash tables, one being and the other being . Each Chunk instance has it's own private data, and all external methods are synchronized. The main thing it does is send a bunch of different messages to other chunks (indirectly through the hash table). Each thread/process has a bunch of currently active chunks that it continuously loops through. Occasionally one chunk will become inactive, and be rolled out and removed from the hash tables. Also occasionally a chunk that's currently rolled out will be activated (rolled in from the database).

      I can see how to do this with threads, if I'm allowed to synchronize methods. It looks difficult to do in C++. (If I'm understanding correctly sharing the concurrent hash tables would be a major problem.) I can see how to do it in Java...partially because of various built in concurrent containers. I can, I think, see how to do it in go, but go appears to be undeveloped in this area. In Python I can see how to do it with threads, but I'd need to build a lot of specialized synchronous things that are already available in Java. I can't see how to do it using multi-process without using managers, and the documentation specifically says that they are notably slow, even compared to normal Python code. It would be easy to do this in D (http://dlang.org/index.html), but D is missing too many libraries. I can "sort of" see how to do this in Ada, but Ada appears to have a diminishing amount of use.

      Because of the above I've started this project in Java. I'm not really happy with it, because of other design decisions that they have made (specifically utf-16...also it feels quite verbose), but it appears to be able to do the job, though I won't really know until I try to run it will a full database, and since things haven't bee written yet...

      P.S.: I considered shared memory maps, but the documentation that I read said that you needed to know the size that they would have before you used them. That's a really bad fit to my application, which expects to grow and shrink the amount of memory that it requires as it is running. (I may even need to wrap Java's ConcurrentHashMap for this reason, so that I can occasionally free memory by replacing the extant tables with new ones if it doesn't free memory properly...but that's a reasonably simple patch that I can add later.)

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    65. Re:Feels Dated by pthisis · · Score: 1

      I think that Slashdot ate some of your formatting (angle brackets?). I'm not sure how the hash table is used for messaging (you might want to consider Unix domain sockets for messaging, depending on what's going on). But...

      You can basically grow shared memory segments on the fly. They're shared in the FS page cache, so if you create a "new" memory mapping on the same backing file that's just bigger, it'll contain all the same stuff in the original segment as the original mapping.

      So you just:

      a = mmap(..., 2 megabytes,...)

      (Use for a while, realize that it's too small)

      old = a
      new = mmap(..., 4 megabytes, ...)
      a = new
      munmap(old)

      You have to do that per-process, but you can either have the initial part of the memory indicate the mapping length (every time you use it, check the length and reallocate if you're off) or you can use a semaphore or socket message or other OOB message to indicate when to resize.

      I don't see how this is (theoretically) any harder in C++ than in Java as far as the problem specifics go (I mean ignoring general reasons that C++ is harder than Java).

      Also when they say that a python Manager object is slow, access to it should be considered similar to access to a synchronized method in Java. But reading large amounts of data over it can be problematic, depending on exactly how you're using it.

      Depending on your access needs and where your bottlenecks are, I'd also consider using memcached or something like that if you think you might ever expand to multiple machines.

      --
      rage, rage against the dying of the light
    66. Re:Feels Dated by HiThere · · Score: 1

      Yeah, angle brackets.

      The hash tables are an active copy of portions of the database. How large they'll be is dynamically variable, but I'll probably limit the [String, long] table to 10,000 or so active entries, though the total size will be around 5,000,000, but most of that will be inactive at any one time. The [long, chunk] table will have much more complex values, and many more of them. Basicly as many as I can manage, though again most of them will be rolled out to the database at any one time.

      C++ would be a lot more complex than Java because I'd need to build many things that are already available in Java....at least if the Boost libraries are any guide.

      As for managed objects...the managed objects would need to be the two main hash tables. And in Java (using threads instead of processes) I can use the already optimized ConcurrentHashMap class. That only locks the entries being accessed rather than the entire table, so there are a lot fewer collisions that would be the case with the Python managed dict.

      OTOH, I have heard tales in the past of people running out of room in the Java VM. It was WRT an older version of Java, however, and I'm hoping that it no longer applies.

      That said, yes, C++ is a complete language, and you can do anything computable with it. But the same is true of assembler. I'd rather not fight against limitations of the language any more than I must. Python was my first choice for this project, and Ruby was my second, but the more I looked into Python, the less promissing it seemed. At this poiint I'm feeling more like trying Ruby than Python...but Ruby also has it's problems, and its been so long since I've looked at it that I don't really remember what they were.

      As for expanding to multiple machines...that's not in the budget for the foreseeable future. When I replace my current machine I'm going to get as many cores as I can afford (as well, of course, as as much RAM, am much disk space, as much speed, etc.), but that's not this month, and likely not this year. And space as well as cost is strictly limited.

      If I were after maximum performance I'd switch to Ada. One of the things I'm trying to optimize, however, is developer time...and I haven't used C++ for over 30 years now. The last time I used it the STL hadn't been adopted. I considered it a superior C in the same way that Fortran95 was a superior Fortran, when compared against Fortram IV. (I only used Fortran G a couple of times.)

      Damn... now I'm going to need to track down again why I rejected Ruby.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    67. Re:Feels Dated by HiThere · · Score: 1

      Well, what I mean is that only one copy of any chunk should exist, and it has no externally writeable state. Strings are immutable. long used as indexes are final. State access is only through functions. The chunks should have no shared state. Readable, yes through a getter function, but what is returned is a copy. Either a number or a very small structure (which given Java has to be a class, but in Python would be a tuple).

      The problem is that the Goetz book (Java Concurrency in Practice) indicates that this may not be sufficient isolation...and that it may not be enough to synchronize all methods (or blocks within methods) that write to the internal state. OTOH, that's a lot better description of what to do than any of the C++ texts I've acquired have, even if it does leave me feeling uncomfortable. I hope he's just being overcautious, but... and his comments aren't actually language specific, but rather have to do with what optimizers do to code.

      To me it looks as if my design SHOULD be thread safe, but I know I'm no expert. Using C++ would apparently require me to become one before being able to do anything. With Java it appears that at most I'll be paying a speed penalty to do things securely, and various comments indicate that if there are no collisions, then synchronization is cheap.

      So as to "what kind of synchronization?", the only place I *see* a need for it is on writes...but that's not what the literature (what I know of it) says is needed. Apparently one can end up with a variable that's half written. Well, this can be handled by (in Java) declaring the questionable variables to be volitile. And synchronizing the writes.

      I don't WANT to become an expert on parallelism. I don't want to need to become one to write a program that uses it. Currently it looks as if this means that C/C++ are poor choices. Poor compared to Ada. Poor compared to D. And poor compared to Java. (There's a difference between becoming reasonably adept and being an expert. I want my expertise to be focused on a different portion of the program than "How can I get things to work in parallel without everything breaking?". That *is* a vital part, but that's why I'm in the process of choosing a language that makes it reasonably easy, and that handles a lot of the sticky parts in a nearly optimal way. (I hope!)

      OTOH, because I don't really like Java, I have been continually looking for something better.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
  2. Keeps getting better. by Anonymous Coward · · Score: 5, Insightful

    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).

    1. Re:Keeps getting better. by Anrego · · Score: 5, Interesting

      I'll agree with C++11 in particular added a lot of stuff that I've been whining about for a long time. It's certainly moved forward and not backwards, and as you said, has managed not to rustle too many jimmies along the way.

      That said, with improvements in hardware and languages like Java becoming way more practical, I just find it hard to justify using c++ for anything that doesn't absolutely need to be in c++, and JNI has made "so just write that one part in c++" a common option as well.

      Not saying the useful space for c++ is gone, just that it's shrinking, and in the area I work, it's practically gone.

    2. Re:Keeps getting better. by gbjbaanb · · Score: 1

      They do prefer to deal with language features, the majority of which I don't think really add much to the language.

      I mean, I'd rather have seen more string operations added to the STL lib than things like 'final' (though admittedly I did have a hard time going through the list finding an example of something that's not too useful).

      I would really rather they spent a lot of time on the infrastructure to C++, like header files that everyone seems to dislike (I like them, if they act as a kind of interface, if they could only make private members tuck away in the cpp file, they'd be great), or more importantly - an ABI for C++ libraries so it could become as widespread as C is and we could write components that actually worked with other builds, no more compiling from source to ensure a fit, no more extern C wrappers around everything you want to call from something else. That kind of thing would make me happy - and I think is the thing thats really missing from C++, after all - boost can provide much of the language features anyone wants.

    3. Re:Keeps getting better. by Anonymous Coward · · Score: 0

      That's 'cause the base language (C++) is so bad that every iteration is cleaning up the mess whereas Java's base was pretty solid and new iterations are someone's pet project add on that squashes it further into the ground.... perspective eh

  3. I think they should all be executed by Oklanhoma by Anonymous Coward · · Score: 0

    The Sooner the Better!

    Java Ruelz!

  4. Re:Simple by Crackez · · Score: 2, Interesting

    Who can't nowadays? Embedded ARM SoCs come with GB's of RAM, and plenty of compute horsepower.

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

  5. Is it really C++ anymore? by Anonymous Coward · · Score: 0

    The concept of a standard library is just baffling.

  6. STL by Anonymous Coward · · Score: 1

    You shouldn't teach STL anymore. The world has moved on to the C++ Standard Library and so should you.

    1. Re:STL by Anonymous Coward · · Score: 0

      The STL (Standard Template Libray) is part of the C++ Standard Library ?!

  7. Re:Simple by Anonymous Coward · · Score: 0, Insightful

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

  8. Re:Simple by bucket_brigade · · Score: 2

    There are applications where no overhead is always better than any overhead. Mostly stuff involving the simulation of physical processes. For example in computer sound synthesis and processing no matter how much computational power you throw at me I will use it up. A musician buys a computer twice as fast as the previous one? Great now he can use 10 convolution based reverbs instead of 5 or use that new virtual analog synthesizer plugin that emulates each transistor of some old korg synth perfectly and he will and his computer will choke just as before. Peoples needs are different. Just because you can't think of uses for extra CPU cycles does not mean other people can't and if your program wastes those cycles people will buy from someone else.

  9. Re:Simple by Drethon · · Score: 1

    I've done a few timing critical programs but I'd prefer to offload that kind of tolerance onto dedicated hardware (simple example a serial UART).

  10. Not just dated... by davecb · · Score: 5, Interesting

    I've used it off and on since "c with classes", and while it's regularly improved at the detail level, it's still
    - non-orthogonal
    - complex
    - exceedingly subtle in spots.

    I think the best characterization is still Ozan's:

    Everyone knows 40% of C++. Unfortunately, it's never the same 40%.

    --
    davecb@spamcop.net
    1. Re:Not just dated... by mr_mischief · · Score: 2

      These are the three points I expect people to realistically bring against Perl. These three are definitely true of Perl as well. Inevitably what most people actually cite are memes about line noise, write-only code, and the impossibility of writing large projects.

      Orthogonality has its merits, but true 100% orthogonality is really rare in a language. Sometimes it's convenient to have a second way to do something, even if it's confusing to have ten ways to do it. Even assembly languages are seldom completely orthogonal. It's easy to see why some languages fall too far on the many ways side of things for some people, though. C++, Perl, APL, and Ruby are guilty as are others.

      Yes, some languages are so complex they have a substantial and often ongoing learning cost. C++, Perl, APL, and Ruby are guilty as are others.

      Subtlety can be really powerful, but too much can cause issues and lends to bugs that are difficult to track down. Obviously Perl is also far on the subtle side of the obvious / subtle line. C++ and Ruby live on the same end of that line, but maybe not quite as close to the end. APL... well, it's APL.

    2. Re:Not just dated... by delt0r · · Score: 1

      That quote sums up just about every single project i have worked on in C++.

      --
      If information wants to be free, why does my internet connection cost so much?
    3. Re:Not just dated... by tree_frog · · Score: 1

      True in many respects :-)

      Actually, my original post was not really meant as a Rubyista fanboi statement - I have worked with a whole host of languages over the past 30 years (Is it that long!!)

      15 years ago when I first discovered Ruby, I used it for scripting data handling from C++ simulations, and then for sketching out ideas on large scale telecoms simulations which were then implemented "properly" in C++. I now can't remember when I last coded in C++ - I use Ruby pretty much everywhere (with the C API where I need real speed and low level interfacing to hardware.

      I guess the point is that things move on and times change. C++ hit the spot in the late 80s and early 90s as it combined Object Orientation with compiled speed. But processors are much faster now and memory is cheaper. So dynamic languages like Ruby and Pythoon become more attractive, as (amongst other things) they are optimized for programmer effort. I have no doubt that they will be eclipsed in their turn by newer and better languages. Particular issues are around concurrency (putting multi-threading across multiple cores) and (for Ruby at least, as has been pointed out) library dependency handling.

      If we can see further, it is because we are standing on the shoulders of giants. Bjarne Stroustrop is one of those giants, and we should be grateful for his efforts, and those of his colleagues on the C++ committees.

    4. Re:Not just dated... by mr_mischief · · Score: 1

      Indeed much of the progress in languages these days is toward getting those performance advantages out of languages built on the lessons of flexible dynamic languages. Go, Rust, D, and even Lua to some extent compromise between a lot of flexibility and ease of prototyping vs. executable speed and error checking by combining thing like easy memory management and generic flow constructs but with tight type constraints and pointers for the actual concrete data items.

      The onus for a lot of the work once done by the programmer in lower-level languages goes onto the compiler, but at the same time the compiler will complain more about type mismatches than with languages that are completely duck typed. These are both wins for overall productivity in my book. Now, as for subtlety, orthogonality, and complexity it remains to be seen where Go and Rust at least truly end up.

    5. Re:Not just dated... by dk400 · · Score: 0

      to those who say C++ is dated... well, yes if you think that most of today's apps are written in Java (or Android Java) or .NET or Objective C ! Yes most of the new code is not in C++. But most of the legacy code that is being maintained is very much in C++ and it is not going away ! Teaching C++ is a good way to start with programming but that does not mean industry needs are in C++... I see Web languages and Ruby, Python more popular than C++ in most projects... just my 2c.

    6. Re:Not just dated... by Anonymous Coward · · Score: 0

      Yeah, but on the converse side there are vast armies of us who still need the speed of compiled code, and for us the likes of Ruby, Python, C#, Java etc. are not going to be sufficient -- and despite what PR might try and tell you, Obj-C has practically zero penetration outside of Apple's ecosystem (and even there I imagine that for portability the vast bulk of developers are writing in C or C++ and binding to an Obj-C wrapper). Not saying a lot of the industry is now on interpreted code -- and even where I work we work in a combination of C#, C and C++ -- but there will always be a place for compiled code and realistically that means C, C++ or, in the fringe, Obj-C.

    7. Re:Not just dated... by epine · · Score: 1

      Everyone knows 40% of C++. Unfortunately, it's never the same 40%.

      What's the problem with that? It's been plenty good enough for religion for thousands of years.

      Everyone knows 40% of the will of god. Unfortunately, it's never the same 40%, so far as we can tell.

      I freely admit that the coefficient of groupthink in C++ is on the low end as modern programming languages go. That's what has always appealed to me about C++: that it was a larger church.

      The value of having a larger church fluctuates in interesting ways, roughly akin to the Titanic. To the passengers on the upper decks, the rafts provided seemed more than adequate. A programming language takes a heavy toll in uncluttered vistas when it elects to support even the guy shovelling coal far, far below the fancy paint.

  11. Re:Simple by Anonymous Coward · · Score: 0

    If I recall correctly, many major developers for the previous generation of game consoles used custom STL implementations because the overhead was too expensive otherwise. Not that the PS3/XBox360 were anything special, but they're not slouches either.

    Example: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html

  12. It's a turd that's slowly being polished by twocows · · Score: 1, Insightful

    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.

    1. Re:It's a turd that's slowly being polished by Anonymous Coward · · Score: 0, Flamebait

      Just because you need your hand held doesn't mean C++ is a turd. It means you aren't qualified to use it.

    2. Re:It's a turd that's slowly being polished by doti · · Score: 1

      D *is* neat.

      The only problem is lack of momentum.

      --
      factor 966971: 966971
    3. Re:It's a turd that's slowly being polished by twocows · · Score: 1

      When I'm working on any project of significance (which isn't often anymore), I tend to write in C, so what you said is about as far off-base as you can get.

      I don't know why you're fanboying about a language like C++ (or any language, for that matter; being a fanboy is stupid, and that is what you're doing), but I was just airing my thoughts on the topic, which is what TFS asked for. If you can't possibly comprehend why someone would deign to suggest your glorious C++ is anything but the result of angels crying tears of code, here's one perspective on some of its issues; it's certainly not the only one of its kind (but it's more in-depth and better-written than anything I'd come up with in a comment on /.).

    4. Re:It's a turd that's slowly being polished by twocows · · Score: 1

      On the other hand, the people behind it seem to be pretty active and passionate about it, which is a good sign.

    5. Re:It's a turd that's slowly being polished by alex67500 · · Score: 1

      Back to my usual joke then...

      There are only 2 types of programming languages, those everybody bitches about, and those nobody uses...

    6. Re:It's a turd that's slowly being polished by BradMajors · · Score: 1

      A problem with C++ is that it is possible to write some very very bad code in C++. I have worked with some companies that are now requiring the use of "C" instead of "C++" to avoid the production of bad unusable code.

      While good C++ code is better than good C code, bad C++ code is much worse than bad C code.

    7. Re:It's a turd that's slowly being polished by MadKeithV · · Score: 4, Interesting

      D *is* neat.

      The only problem is lack of momentum.

      It was Bjarne himself who said that there are two kinds of programming languages: those everyone complains about, and those that nobody uses.
      On-topic, lots of people are going to hate C++, for its multi-paradigm "everything and the kitchen sink" approach combined with near-C-compatibility and low-levelness. It's the kind of language where two programmers come up with five different ways to do the same thing, and four of them are probably wrong in non-obvious ways. It's fun though, in the way that a high-performance sports car is fun to drive, but easy to wipe out.
      I've been using it professionally for 15 years now, and if I observe anything, it's that the longer I use it, the more my stuff looks like C. I keep shaking my head at younger colleagues mis-using templates all over the place ("re-usability!", and hour-long compile times, coupled with really non-obvious implicit conversions and instantiations, never mind the error messages), and object-oriented hierarchies where each object is such a tiny part of the system that you need to remember 10 classes at the same time just to have a slight inkling of what this thing is actually supposed to do.
      I still have that nearly irresistible urge to defend the language whenever discussions like these come up, but so much of that is because it's the language I use all bloody day. And then I write something incredibly useful in 10 lines of Python.....

      C++ has its place, a masochistic place, ostensibly programming a higher-level abstraction than the people writing plain C ("troglodytes!", but most of them actually seem to know what they are doing and rustle up the higher-level abstractions directly in C, I have respect for you guys), and the people who don't have that much need for low-level features, the last drops of performance or cross-platform compilation (you're probably working in Java, C#, Python, Ruby, and *enjoying it* most of the time. And yes, you Java guys have every right to tear into me about cross-platformness, it's not like it's just hand-waving in C++ either). It's sort of a similar niche to PHP I guess. You know full well that a lot of the reasons for the hate are true, but all you have is this swiss-army-knife of a hammer and everything must be a nail.

    8. Re:It's a turd that's slowly being polished by RoccamOccam · · Score: 1

      Why is that, I wonder?

    9. Re:It's a turd that's slowly being polished by bytesex · · Score: 0

      Can you read? The person you replied to was not fanboying about C++ at all!? He was calling it a turd!

      --
      Religion is what happens when nature strikes and groupthink goes wrong.
    10. Re:It's a turd that's slowly being polished by TheRaven64 · · Score: 1

      You probably haven't seen truly bad C code then. Really bad C code tries to do C++ templates using the preprocessor, where you define a few macros variables and then include a file that recursively includes other files to a depth of four or more, eventually resulting in the code that you wanted. The one thing this has over C++ templates is that you can read the output of the preprocessor and look for the bugs. Good luck fixing them thouhg.

      --
      I am TheRaven on Soylent News
    11. Re:It's a turd that's slowly being polished by twocows · · Score: 2

      It was Bjarne himself who said that there are two kinds of programming languages: those everyone complains about, and those that nobody uses.

      I'm sure that was said more or less as a joke, but it rubs me the wrong way. The basic suggestion here is that no language that reaches sufficient usage is going to be without its problems. That's fair, but I'm reading from it an implication that the criticism is purely due to its popularity, and that's not fair. There are a lot of problems with C++; some are fixable, some are too inherent in the design to be fixed. A lot of what could be fixed has been, and that's fantastic, but there's still plenty of room for legitimate criticism that has nothing to do with hating what's popular.

      Regarding languages that "nobody uses," that doesn't necessarily say anything about their quality; some things just don't take off for whatever confluence of reasons. It remains to be seen whether D specifically will or will not, but from what I understand, it is very well-designed and avoids a lot of the design issues present in C++. That's really cool if true and I'm looking forward to seeing if those claims hold up.

    12. Re:It's a turd that's slowly being polished by wertigon · · Score: 1

      Don't you mean

      There are only 10 types of programming languages, those everybody bitches about, and those nobody uses...

      --
      systemd is not an init system. It's a GNU replacement.
    13. Re:It's a turd that's slowly being polished by MadKeithV · · Score: 1

      It was Bjarne himself who said that there are two kinds of programming languages: those everyone complains about, and those that nobody uses.

      I'm sure that was said more or less as a joke, but it rubs me the wrong way. The basic suggestion here is that no language that reaches sufficient usage is going to be without its problems. That's fair, but I'm reading from it an implication that the criticism is purely due to its popularity, and that's not fair. There are a lot of problems with C++; some are fixable, some are too inherent in the design to be fixed. A lot of what could be fixed has been, and that's fantastic, but there's still plenty of room for legitimate criticism that has nothing to do with hating what's popular.

      I'm not sure there's THAT much room for legitimate criticism in C++, if you know the basic inviolate root principles of the language. Or to put it another way, anything that fixes those particular problems would not be C++ anymore. I think D attempted to fill that niche, and it has failed to gain traction, no matter how good it seems. My implication in posting that quote was "if D was popular, people would be complaining about it too", because all languages have a determined set of detractors (anti-Java "not everything fits into OO", anti-Python "whitespace isn't a substitute for program structure", anti-Lisp "how many brackets do you need")....

      Regarding languages that "nobody uses," that doesn't necessarily say anything about their quality; some things just don't take off for whatever confluence of reasons. It remains to be seen whether D specifically will or will not, but from what I understand, it is very well-designed and avoids a lot of the design issues present in C++. That's really cool if true and I'm looking forward to seeing if those claims hold up.

      Popularity and quality aren't linked (I compared C++ to PHP in another comment), and I don't mean to imply that D is rubbish. I've given it a cursory glance several times over the years. It just doesn't seem to have a compelling argument for my use - I'm already in C++, and if I have enough leeway to go higher-level I tend to end up in Python, with the massive library of useful stuff behind it.

    14. Re: It's a turd that's slowly being polished by Anonymous Coward · · Score: 0

      Bad code is just bad. You wouldn't believe the level of ingenuity I've seen in making borderline malicious C code. C++ gives you more tools in the toolbox, but that just means you have to be more creative with C to replicate those concepts.

      Polymorphism - void* and function pointers.
      Templates - use macros in a non-type-safe manner or use code generation.

      C++ gives you the gun for which to shoot yourself in the foot, but you can still build your gun in C.

    15. Re:It's a turd that's slowly being polished by delt0r · · Score: 1

      Yea, my personal favorite is Lisp. Good luck finding anyone else that can code it.

      --
      If information wants to be free, why does my internet connection cost so much?
    16. Re:It's a turd that's slowly being polished by Rei · · Score: 4, Funny

      C: "Here's a gun. Don't shoot yourself in the foot."
      C++: "I see you've been shooting yourself in the foot! Well, here's a different gun, rather like your old one, only we've added a safety and a trigger guard and oh by the way it now shoots 40 caliber shells containing fission-warheads."
      Python: "Have a wiffle bat."

      --
      When was the last time you ran anywhere? I mean with your own legs, not by pressing 'X'?
    17. Re:It's a turd that's slowly being polished by Glock27 · · Score: 1

      I'm not sure there's THAT much room for legitimate criticism in C++, if you know the basic inviolate root principles of the language. Or to put it another way, anything that fixes those particular problems would not be C++ anymore.

      True, but it might well fill the same niche and be quite a bit better...

      I think D attempted to fill that niche, and it has failed to gain traction, no matter how good it seems.

      Wrong tense. D "is attempting" to fill that niche, and so far has failed to gain (much) traction.

      D is actually picking up some momentum - it's now being used fairly heavily at Twitter for instance. It's still a quite young language, only invented in 2004.

      That said, D does have it's challenges, particularly in that only two people decide what actually goes in the language. They're smart, but like anyone they have their blind spots. It also has reneged on some of the early promises, in particular "optional garbage collection". There is some ongoing work to fix that oversight, though.

      My implication in posting that quote was "if D was popular, people would be complaining about it too", because all languages have a determined set of detractors (anti-Java "not everything fits into OO", anti-Python "whitespace isn't a substitute for program structure", anti-Lisp "how many brackets do you need")....

      Oh, don't worry, there are plenty of folks constantly complaining about D (check the forums at dlang.org). However, one thing almost all of them have in common is a desire for something better than C++, and many find that in D despite its various warts.

      Regarding languages that "nobody uses," that doesn't necessarily say anything about their quality; some things just don't take off for whatever confluence of reasons. It remains to be seen whether D specifically will or will not, but from what I understand, it is very well-designed and avoids a lot of the design issues present in C++. That's really cool if true and I'm looking forward to seeing if those claims hold up.

      It's worth keeping an eye on, for sure. Walter Bright (the original inventor) has been writing articles at drdobbs.com, they're worth checking out.

      Popularity and quality aren't linked (I compared C++ to PHP in another comment), and I don't mean to imply that D is rubbish. I've given it a cursory glance several times over the years. It just doesn't seem to have a compelling argument for my use - I'm already in C++, and if I have enough leeway to go higher-level I tend to end up in Python, with the massive library of useful stuff behind it.

      I like Python as well, and pypy is looking pretty good as a performance enhancement. Multithreading is is still a problem though.

      A couple of other newish languages worth noting are Scala and Julia.

      So far Scala is only on the JVM, but it's a powerful, clean language and a huge improvement over Java. It includes functional language features along with OO.

      Julia has the potential to be general purpose, but thus far is oriented towards "technical computing" (the same niche as Matlab and R). It's LLVM based and offers easy interoperability with C libraries.

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
    18. Re:It's a turd that's slowly being polished by Rei · · Score: 3, Insightful

      #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.

      --
      When was the last time you ran anywhere? I mean with your own legs, not by pressing 'X'?
    19. Re:It's a turd that's slowly being polished by K.+S.+Kyosuke · · Score: 1

      I've seen code like that once. It didn't look bad at all, though, since it was written by a very capable guy who knew what he was doing, and it was heavily commented for sake of idiots like me.

      --
      Ezekiel 23:20
    20. Re:It's a turd that's slowly being polished by khellendros1984 · · Score: 1

      Just because you need your hand held doesn't mean C++ is a turd. It means you aren't qualified to use it.

      I'd paraphrase that more as "C++ is good, and you're too stupid to realize it." The AC wasn't calling C++ a turd.

      --
      It is pitch black. You are likely to be eaten by a grue.
    21. Re:It's a turd that's slowly being polished by Megane · · Score: 1

      It is salvageable if you throw away most of it. Using it as "C with classes" has a lot of potential. C++ does have a few problems that made templates necessary, but that doesn't mean that I don't think templates aren't a fucking mess, or that you even need to use them.

      Look at mbed as an example of using C++ without templates or iostreams. Classes are treated as an API to hardware, with a single object representing one instance of a hardware device, containing the port/unit number and state. For instance, to use Timer 3 in a microcontroller, you would create an timer class object and initialize it with the number 3, like a declaration of "Timer t3(3);" then do things with it like "t3.SetMode(Timer::MODE_PWM); t3.SetCount(1000); t3.Start();".

      Just remember that the only difference between a struct and a class is that a class's members are private by default, and a struct's members are public by default. So all you're doing is adding function calls to a struct, with the struct's address being an implicit pointer called "this", and whose elements don't need extra syntax to access them, just like locals and globals.

      --
      #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    22. Re:It's a turd that's slowly being polished by Megane · · Score: 1

      And any C code that makes heavy use of pointers to functions could probably be written much better in C++ using virtual methods, even without templates.

      --
      #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    23. Re:It's a turd that's slowly being polished by doti · · Score: 1

      Lack of openess.

      From Walter Bright, creator of D (emphasis mine):

      My natural tendency is to work solo on things. My work performance reviews at the various jobs I've had usually included comments like "Walter needs to learn to work better with others." My desire to control everything nearly wrecked the D community at one point, and I've had to change.

      Source:
      http://www.drdobbs.com/archite...

      --
      factor 966971: 966971
    24. Re:It's a turd that's slowly being polished by Darinbob · · Score: 3, Funny

      JavaScript: "here, let's point your gun at the customers instead".

    25. Re:It's a turd that's slowly being polished by Raenex · · Score: 1

      D is actually picking up some momentum - it's now being used fairly heavily at Twitter for instance. It's still a quite young language, only invented in 2004.

      It's actually quite old for a "new" language. The announcement (with a draft specification) came in 2001. Thirteen years later and it's still a niche language. Can you name a major language in use that wasn't firmly established within 10 years?

      That said, I think D still stands a chance, even though they don't have their story around garbage collection sorted out, and I'm not sure what shape their troubled concurrency story is in either.

    26. Re:It's a turd that's slowly being polished by alex67500 · · Score: 1

      Yeah... I stopped at my emacs config, that was enough for me ;-)

    27. Re:It's a turd that's slowly being polished by david_thornley · · Score: 1

      The C++ FQA is a pile of biased crap. I went over a random chapter, and found several false statements, a general lack of knowledge of how to use C++, and a lot of idiosyncratic style complaints.

      There's a couple of things that indicate to me that somebody is thoroughly ignorant of how C++ works, and should not be commenting: the use of "C/C++" as if it were not two different languages, and mention of the FQA. Not that there's anything wrong with not knowing C++, but I do like to have some idea of what I'm talking about, personally.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    28. Re:It's a turd that's slowly being polished by david_thornley · · Score: 1

      Ever notice that almost nobody seems to like both C++ and Lisp? I'm weird that way, being very fond of both.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    29. Re:It's a turd that's slowly being polished by Pseudonym · · Score: 1

      My two favourite languages are C++ and Haskell (not in that order), so I feel for you, dude.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    30. Re:It's a turd that's slowly being polished by Pseudonym · · Score: 1

      My implication in posting that quote was "if D was popular, people would be complaining about it too", because all languages have a determined set of detractors (anti-Java "not everything fits into OO", anti-Python "whitespace isn't a substitute for program structure", anti-Lisp "how many brackets do you need")....

      I'm glad you mentioned that, because I got the exact converse. If D was popular, more people would be trying to do very hard things in D, and so the problems in the language would be more apparent.

      The best critics of C++ are hard-core C++ users, because their criticisms are usually accurate. People who complain about bloat have, almost all of the time, never used C++ for anything nontrivial. I know this partly because I used to say the same things; I didn't understand why the C++ language isn't bloated until I learned from bitter experience why all that is there. (The standard libraries, on the other hand, are definitely bloated.)

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    31. Re:It's a turd that's slowly being polished by Pseudonym · · Score: 1

      Can you name a major language in use that wasn't firmly established within 10 years?

      C++, Objective-C, and SQL are the most obvious ones. ML and Haskell (while not as "major") also took a long time to find their feet.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    32. Re:It's a turd that's slowly being polished by Raenex · · Score: 1

      C++

      Started in 1979 (which for D is 1999), and by 1987: "In 1987 USENIX, the UNIX Users' association, took the initiative to hold the first conference specifically devoted to C++. Thirty papers were presented to 214 people in Santa Fe, NM in November of 1987." (page 36 in A History of C++: 1979-1991.

      Objective-C

      Debatable. From Wikipedia: "Objective-C was created primarily by Brad Cox and Tom Love in the early 1980s at their company Stepstone.[2] Both had been introduced to Smalltalk while at ITT Corporation's Programming Technology Center in 1981. The earliest work on Objective-C traces back to around that time.[3] [..] In 1988, NeXT licensed Objective-C from StepStone (the new name of PPI, the owner of the Objective-C trademark) and extended the GCC compiler to support Objective-C, and developed the AppKit and Foundation Kit libraries on which the NeXTstep user interface and Interface Builder were based. While the NeXT workstations failed to make a great impact in the marketplace, the tools were widely lauded in the industry. This led NeXT to drop hardware production and focus on software tools, selling NeXTstep (and OpenStep) as a platform for custom programming."

      So while Objective-C really didn't take hold until it was the de facto implementation for iOS, it was a central component for a major commercial endeavor, and went with Jobs to Apple.

      SQL

      From Wikipedia: "SQL was initially developed at IBM by Donald D. Chamberlin and Raymond F. Boyce in the early 1970s.[13] [..]

      In the late 1970s, Relational Software, Inc. (now Oracle Corporation) saw the potential of the concepts described by Codd, Chamberlin, and Boyce and developed their own SQL-based RDBMS with aspirations of selling it to the U.S. Navy, Central Intelligence Agency, and other U.S. government agencies. In June 1979, Relational Software, Inc. introduced the first commercially available implementation of SQL, Oracle V2 (Version2) for VAX computers.

      After testing SQL at customer test sites to determine the usefulness and practicality of the system, IBM began developing commercial products based on their System R prototype including System/38, SQL/DS, and DB2, which were commercially available in 1979, 1981, and 1983, respectively.[15]"

      What did D have going for it in 2009 in comparison?

      ML and Haskell (while not as "major") also took a long time to find their feet.

      I'll pass on these. They're both still niche. Anyways, it's been 15 years since the start of D (or 13 since the work has been made public). It's hardly a young language, especially when you compare it to the success C++ had on the same timelines, which is the most appropriate comparison here.

    33. Re:It's a turd that's slowly being polished by MichaelSimpson77 · · Score: 1
      If you can't stand C++, you probably don't have the experience to objectively comment on the language. I have ported several projects from VB, C# and Java to C++, when the client was not able to get the required performance from the product. Both of the VB projects were Pocket PC projects, one for Sprint and NASCAR and one for remote order taking. The problem in both of these cases were the start-up times were three and two minutes respectively. In addition, the products were static in nature, i.e. the number of functions were fixed. The client originally signed on to this language because development was going to be 1/10th the time so they would get to market quicker. Both projects were bid in terms of a few months. The language experts did deliver the products on time but were not able to get past the performance problems. I get brought in. I don't have to do the design, as the VB projects function as the desired product. I use ATL (active template library) along with the HP variant of STL. I also deliver the product in several months, but my start up times are measured in one to two seconds. In addition, using an optimized version of an XML parser I wrote, the menu processing went from a minute to a few seconds. The functionality of the products were not static in that I could dynamically allocate more features as needed.

      On the server side of the NASCAR project, the JMS on a Tomcat server was able to handle 2000 concurrent connections. A C++ implementation was able to handle 40,000 concurrent connections. That increase means less hardware, less power. It seems that the Java server side mantra is throw more hardware at the problem.

      Several C# projects also suffered from performance problems. The customers bought into the platform again because of the short development time. By utilizing Qt and C++, we were able to develop a highly polished product in the equivalent time as the C# product. We however were able to respond to 10 millisecond performance windows that are an absolute requirement of the project.

      One thing that disappoints me is the quality of software engineers we encounter when we do college recruiting. It seems that the "hardest" language learned is Java. Assembly is an optional course and C++ is taught as a part of comparative languages. As a consequence, we see a number of people who consider themselves software engineers but don't have a good theoretical back ground in what the hardware is doing underneath. Then when these same engineers encounter a performance bottleneck, they don't have the tools to solve those bottle necks.

      To get back on topic, I like STL and the evolutions of C++. It talked to Stroustrup about STL and told him that it was a good addition that I didn't initially grok. He said he had the same experience as well. Twocows, keep at it. You just might find a diamond in your turd.

    34. Re:It's a turd that's slowly being polished by Anonymous Coward · · Score: 0

      K. S. Kyosuke: You've been called out (for tossing names) & you ran "forrest" from a fair challenge http://slashdot.org/comments.p...

  13. Meh by Anonymous Coward · · Score: 1

    I've spent 12 years coding C++ for a living.

    IMO, The new C++11 stuff is mostly aimed at library developers, with an emphasis on template heavy libraries like boost and the stl (which are both fantastic, don't get me wrong). It offers some minor syntactic sugar, but mostly it doesn't have a lot to offer application developers. The committee has put off dealing with the features most non-embedded applications developers have long been begging for: garbage collection, and runtime reflection.

    1. Re:Meh by OneSmartFellow · · Score: 2

      I don't know anyone who worries about garbage collection in C++11.

    2. Re:Meh by turgid · · Score: 4, Funny

      I don't know anyone who worries about garbage collection in C++11.

      Quite. The OS cleans it all up after the application exits, anyway.

    3. Re:Meh by MadKeithV · · Score: 2

      I assume what GP means is std::unique_ptr, std::shared_ptr, std::make_shared, and then your own custom make_unique because they forgot that in the standard and a bunch of std::moves to convert the canonical unique_ptr from your factory functions into the shared_ptrs that you are actually using everywhere else.

      And then fighting with the several iterations of only half-done C++11 implementations in recent versions MSVC compared to the better support in Clang while trying to keep your code compiling across 4 different platforms with as little use of #ifdefs as possible. May the noodley-appendaged one help you if you were hoping for easy multi-threading or unicode support.

      I keep telling myself I like this language, but who am I kidding ;-). Seriously though, the language has made strides with C++11 and C++14, but it will always remain a minefield of ways to stab, shoot, detonate, incinerate and irradiate yourself in the foot, with some implicit casting to hands and other appendages thrown in.

    4. Re:Meh by bhlowe · · Score: 1

      Exactly: The OS releases the memory after the application sigfaults.

    5. Re:Meh by Jamu · · Score: 1

      I think garbage collection is a library issue, not something that should be in the core language by default.

      I'd like to see runtime reflection with the proviso that it's static. It's my thinking that reflection should be compile-time for a compiled language.

      --
      Who ordered that?
    6. Re:Meh by Bryan+Ischo · · Score: 1

      Runtime reflection - I added it to C++ a long time ago:

      http://www.ischo.com/xrtti/

      But nobody cared ...

      p.s. Don't try to use it; I haven't maintained it for years, and I have no idea about the state of gccxml these days. But you can read the API docs for an idea of the kinds of reflection that it enabled.

    7. Re:Meh by EMG+at+MU · · Score: 1

      I don't know anyone who worries about garbage collection in C++11.

      Quite. The OS cleans it all up after the application exits, anyway.

      Unfortunately not true for drivers/dlls. The freestore belongs to the loading process, so any unreleased memory still exists after the driver unloads.

    8. Re:Meh by gbjbaanb · · Score: 1

      I don't know anyone (sensible) who wants GC or reflection.

      Sure, there's a lot of hype about them (thankfully reducing as people realise they aren't the silver bullets they were promoted as) but they just aren't good - not when you have better in C++ in the first place.

      There's a few features - variadac initialisation, new for loop, lambdas. They're nice... but as you say, nothing that couldn't be done with a little more typing. (strangely the types who complain that you have to type a little more text are the ones who have functions like the GetTextEffectCharacterIndexFromTextSourceCharacterIndex method of System.Windows.Media.TextFormatting.TextSource :)

    9. Re:Meh by GiganticLyingMouth · · Score: 1

      Well, C++ threads and the new memory model would take more than just a little more typing. Same for rvalue references.

    10. Re:Meh by turgid · · Score: 1

      What sort of Mickey-Mouse OS doesn't clean up after its dynamic libraries?

    11. Re:Meh by EMG+at+MU · · Score: 1

      It isn't that the OS doesn't clean up. In embedded compact as I understand it, all the dlls loaded under a process share that processes' free store. If Driver.exe loads a dll (as is the case with kernel mode dlls) then that dll is using Driver.exe's free store and the OS won't magically free memory allocated to the dll when it is unloaded.

    12. Re:Meh by david_thornley · · Score: 1

      Thing about garbage collection is that, while it's better than what C++ has for memory, it doesn't handle all the other resource disposal tasks that C++ handles in the same way as memory. GC makes memory easy, and doesn't address database connections or file handles or anything like that. RAII isn't as easy as the usual GC, but handles everything. There's a tradeoff here.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    13. Re:Meh by Pseudonym · · Score: 1

      I don't know anyone (sensible) who wants GC or reflection.

      Nobody wants "reflection" exactly, but lots of people want some kind of meta-object protocol. Any time you need a scripting layer, you need that. Just imagine how much nicer Qt would be without moc.

      But you generally only want it when you want it. Unfortunately, you pay for a MOP even when you don't use it.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    14. Re:Meh by iguana · · Score: 1

      What if your application never exits? Embedded stuff is expected to run for months. We could never use a garbage collected language.

    15. Re:Meh by turgid · · Score: 1

      What are watchdog timers for? When the RAM fills up and the program gets corrupted...

  14. The build process is still shyte (?) by AnontheDestroyer · · Score: 2

    I haven't worked with C++ much for about 3 years, but when I did, manually editing Makefiles and the like caused more than a little indigestion. After having worked with Python, JavaScript with Grunt, several IDEs, and even crap like Maven for Java/Scala projects, I don't want to go back to the early steps of getting C++ projects just to execute. There seems to be no doubt that I've missed some developments in that area in the last few years, though.

    1. Re:The build process is still shyte (?) by stewsters · · Score: 2

      Has anyone tried gradle for c++? It works well for java (less XML than maven, yay), but I haven't tried a lot of other languages.

    2. Re:The build process is still shyte (?) by Anonymous Coward · · Score: 2, Interesting

      The problem isn't the tools to build C++ it's the nature of C++. Things like Java, Python, (and I assume JS) are easy because they're built on the idea of importing modules where C/C++ is built on linking translation units.

    3. Re:The build process is still shyte (?) by robmv · · Score: 1

      When I was trying to learn a more system level languages from higher level ones like Smalltalk, I found Makefiles to be archaic. I was delighted when IBM introduced what they called Configuration files on VisualAge C++ (PDF) (see Chapter3. An introduction to configuration files). It was easy to manage and the integration with the IDE was great (one of the first C++ IDEs I really liked). But the configuration files were hated by the people used to the Makefiles, it wasn't well received. As an newbie at that time with C++, I loved them, today I can tolerate Makefiles but they are more archaic now than before.

    4. Re:The build process is still shyte (?) by sdw · · Score: 1

      CMake makes C++ development relatively painless for cross-platform development.
      For several years, I've been setting up and using Linux/MacOSX/Windows/Android (and to some extent iOS) builds.
      I'm about to add Emscripten as a target for some project libraries.

      --
      Stephen D. Williams
    5. Re: The build process is still shyte (?) by Anonymous Coward · · Score: 0

      After not using C++ for 5 years or so, I started using C++ again last year. I found that much of the work editing Makefiles and the like are actually unnecessary: they can all be automated after some thoughts. I'm not using automake, not cmake, and not any pre-packaged solution. I only have the following rule when writing the code: ensure that you #include a header if and only if you also want its corresponding source file, if it exists. With that, g++ -MM will give you all the information to generate the Makefile dependencies.

      With recent things like Google test and Google mock, even writing unit tests in C++ are not as painful as it previously feels. IWYU also help ensuring that you don't get unnecessary stuff in your code (and your binary, if you do automatic dependency generation with headers).

      I don't need the code to be portable, though, which does simplify things a real lot.

      All these are off-topic, since I still don't use C++11.

    6. Re:The build process is still shyte (?) by Pseudonym · · Score: 1

      Since nobody in their right mind would start a new C++ application without Boost these days, there's always Boost.Build. It's pretty nice.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    7. Re:The build process is still shyte (?) by aled · · Score: 1

      I tried the previous versions but the c/c++ Support was still incubating and could not support library interdependence. I think that was fixed in the later releases but haven't had time to check.
      building with external libraries is a pain in c++ compared to java.

      --

      "I think this line is mostly filler"
  15. The STL is too general purpose by mark-t · · Score: 0

    I think the STL is amazing, and I'm glad that it's a standard part of C++, but in my experience, it's usually far too general purpose to wind up in production code. This flexibility comes at a performance cost that, however modest it may be, can often simply not be worth the hassle of maintaining. I may use the STL during prototyping, or when first implementing an algorithm in code, but will often incrementally move to using custom types as a project develops.

    1. Re:The STL is too general purpose by Anonymous Coward · · Score: 0

      I don't quite understand your statement that being too general purpose comes at performance cost. It's compile time binding after all and once compiled, traversing a vector is little more than increasing a pointer. We use STL in production code all the time in real time graphics applications. Although it does come with additional cost, but in my experience if such cost becomes significant, it generally indicates a deficiency in the algorithm or fundamental data structure design. It does require the programmer having an idea of each container's ideal situation of application. The less informed programmers tend to over use STL for convenience, and unknowingly make their algorithm O(n^2) instead of O(n) by choosing the wrong container.

      It's trendy to bash C++ nowadays, but I've yet to see another language that can compete with C++ on performance and features, and best yet direct compatibility with C. I do hope that's a cleaner language that can supersede C++ without loss of its strength but so far none has come up.

    2. Re:The STL is too general purpose by MalleusEBHC · · Score: 1

      I second a lot of these points. In the vast majority of cases, STL is plenty fast as long as you choose the correct container. If you're not able to pick the correct container, you'll be equally hopeless creating your own data structure.

      In the absolutely performance-critical pieces, rolling your own data structure is often worth the cost over STL. However, many people mistake how many pieces are truly performance-critical. As Knuth correctly pointed out, premature optimization is the root of most/all evil. In most cases, you're better off with the consistency, readability, and reliability of STL over a homegrown data structure with unfamiliar syntax and potential bugs.

      It's trendy to bash C++ nowadays, but I've yet to see another language that can compete with C++ on performance and features, and best yet direct compatibility with C. I do hope that's a cleaner language that can supersede C++ without loss of its strength but so far none has come up.

      Have you tried C++11? It makes it possible to write much cleaner code than C++98.

    3. Re:The STL is too general purpose by Anonymous Coward · · Score: 0

      Youre right but i think your answer lets people draw the wrong conclusion. It implies that STL-containers actually do have overhead that might be circumvented by using a "handcrafted alternative". You say it is "plenty fast", when in fact it is "as fast as it gets". I guess it would be very hard to come up with a auto-growing structure to replace for example std::vector in a way that retains funcionality and has better performance. Even a new/malloced array wont beat it, even if a lot of non-c++ programmers arguing here would believe so.

    4. Re:The STL is too general purpose by Mr+Z · · Score: 1

      You do have to be sure to compile with full optimization enabled, though, for STL to have a minimal hit. I use STL quite happily to do things I only too eagerly rolled my own implementation of years ago, and then clung to, even if it wasn't a perfect fit. For example, for eons I carried around this AVL tree implementation I wrote for a data structures class, and used it to implement associative containers, just so I wouldn't have to do it again. These days, it's simply map< yadda, yadda > and I'm on my way. I'm willing to bet map<> beats that creaky old AVL tree any day.

      Without optimization, the STL containers can slow down quite a bit. I've heard the effect is especially large on some versions of MSVC++, since they have special debugging versions of the iterators that incur their own cost penalties in return for other checks. I wouldn't know; I do all my development under Linux or for embedded processors on bare metal.

      With optimization on, I rarely if ever notice a performance issue due to STL. I do run into the occasional limitation, such as needing an actual resizeable 2-D array-like structure. (A vector< vector< ... > > doesn't cut it, because resizing the inner dimension doesn't resize all rows.) But, that's more exception than rule.

      My biggest complaint about C++11 is that I won't realistically be able to use it for another few years. Grrr.

  16. Re:Simple by paskie · · Score: 1

    A lot of people in embedded are still bit twiddling on an AVR. :-) Or a smaller ARM uCU like in the mbed board.

    --
    It's not the fall that kills you. It's the sudden stop at the end. -Douglas Adams
  17. Re:Simple by Anonymous Coward · · Score: 1

    What makes you think that the STL is going to be slower?

  18. Re:Simple by OrangeTide · · Score: 1

    Who can't afford overhead and bloat?

    The Hypervisor for those Embedded ARM SoCs. HYP mode is appropriate for a kernel that is only a few dozen kilobytes in size, and ARM's HYP mode doesn't play nicely as a Type-2 hypervisor (KVM, VMware, etc).

    Plus your typical ARM SoC has several DSPs or microcontrollers on the chip.

    I guess we're still not to the point where we can have one programming language we use for everything. I mean if you ignore plain old boring C as an option.

    --
    “Common sense is not so common.” — Voltaire
  19. Re:Simple by tobe · · Score: 1, Insightful

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

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

  20. c++ has greatly improved, also thanks to STL by kinkie · · Score: 4, Interesting

    The STL does one thing very well: it's very predictable performance-wise while being reasonably useable.
    When you use it, you know perfectly what the performance is going to be.
    It also offers some occasionally-useful features (std::weak_ptr for instance). c++11's move constructors and rvalue references are very good for squeezing out the last bit of performance where possible and for ensuring exception safety to certain operations; although it's mostly useful for very low-level, entrenched libraries such as the STL. Lambdas are syntactic sugar, but a well flavored one.

    c++ is now a very different beast than it was in the 90s. If used properly, it can be very effective (performance-wise) in complex projects. But it can also give programmers tons of rope to hang themselves with.

    --
    /kinkie
    1. Re:c++ has greatly improved, also thanks to STL by Coop · · Score: 2, Interesting

      The trouble with a language giving tons of rope to hang oneself is, on a team project, there will always be some coders who will in fact hang themselves, and in doing so hang the whole project. That's why C++ is OK for small/one-coder projects, but Java is the language of choice for big teams. Of course the whole project can also be hanged by the designers and architects...

      --
      "If you're not passionate about your operating system, you're married to the wrong one."
    2. Re:c++ has greatly improved, also thanks to STL by Anonymous Coward · · Score: 0

      Or you can, you know, fire the stupid people.

    3. Re:c++ has greatly improved, also thanks to STL by microbox · · Score: 3, Interesting

      Lambdas are syntactic sugar, but a well flavored one.

      Lambda are the one feature that keeps me using C++. Once you grok functional programming, you'll never do with out. Writing whole functor classes is a huge amount of work, and error prone, for the type of things I need them for. There's a reason why old C++ code didn't make heavy use of them -- yet if you go into the world of functional programming, they are everywhere, and your code is much shorter and more predictable.

      My old supervisor was convinced that a certain portion of people simply don't ever make the cognitive leap.

      --

      Like all pain, suffering is a signal that something isn't right
    4. Re:c++ has greatly improved, also thanks to STL by labnet · · Score: 0

      Posting to undo incorrect moderation. (Was trying to mod you up not down)

      --
      46137
    5. Re:c++ has greatly improved, also thanks to STL by david_thornley · · Score: 1

      To be honest, I've never used a computer language where it was the least bit hard to write bad code (except for languages like Intercal where it's hard to write any sort of code). I'd rather run a project by ditching any coder who's going to be deadweight or worse than by choosing a tool because limits the harm you can do. (There are some exceptions; security software, for example, can benefit from a language designed to be secure. Of course, those who will refuse to use safety features present in C *cough*Heartbleed*cough* are going to be able to hash anything up. (The use of calloc() instead of malloc() would have made Heartbleed itself impossible to exploit (Yes, I do like Lisp.).))

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    6. Re:c++ has greatly improved, also thanks to STL by PoL0 · · Score: 1

      You should check your team if the barrier to use C++ is your own developers. Unless you are ok with developing using Java...

  21. Back in the day I did a lot of c++ by OzPeter · · Score: 1

    Back in the day I did a lot of c++, but nowadays I prefer things like c# (partly because I don't have to deal with header files any more). But I still keep tabs on C++ through reading questions on stack overflow. And what really amazes me is the number of "language lawyer" questions arguing over the precise definition of some point in a C++ standard - and that scares me into believing that no sane person could ever write well formed c++.

    --
    I am Slashdot. Are you Slashdot as well?
    1. Re:Back in the day I did a lot of c++ by frank_adrian314159 · · Score: 1

      C++: The only language where exception handling interacts with the rest of the system in such a non-trivial way that you need an entire book to explain it correctly.

      --
      That is all.
    2. Re:Back in the day I did a lot of c++ by GiganticLyingMouth · · Score: 1

      Not sure if I'm missing the joke here (if so, apologies), but just because the book title is "Exceptional C++" doesn't mean the whole thing is about exceptions.

      Exceptions are covered for a few chapters in that book, but some of the recommendations aren't really relevant anymore; C++11 deprecated many of the problematic parts of exceptions (e.g. exception specifications), and much like valarrays, no one really used them anyways

  22. ofcourse why not~ by Anonymous Coward · · Score: 0
  23. In Academic Projects by ajyand · · Score: 2

    We use C++ exclusively for academic projects but we rarely use STL for performance reason. Some of the C++11 functions really come to rescue like number to string conversion, time keeping etc that may save a day but in general we use "templates" almost everywhere but use of STL is limited to some once in a while operations like loading data from an input file.

    1. Re:In Academic Projects by Yosho · · Score: 1

      Out of curiosity, what are you doing that is so performance intensive that you can't use the STL? Have you done profiling on STL vs. custom containers to compare how efficient they are?

      --
      Karma: Terrifying (mostly affected by atrocities you've committed)
    2. Re:In Academic Projects by Anonymous Coward · · Score: 0

      So you wrote your own vector ?

    3. Re:In Academic Projects by Anonymous Coward · · Score: 1

      STL usually isn't a problem on the CPU. As another poster pointed out, the running time is quite predictable - and pretty good.

      But the memory overhead can be prohibitive in some cases. It tends to do many small allocations which in itself has a significant overhead and also leads to fragmentation of the heap. This is particularly nasty on systems without virtual memory.
      Specialized classes can provide much better memory use.

    4. Re:In Academic Projects by sconeu · · Score: 2

      You can provide a custom allocator to Standard C++ containers to alleviate your fragmentation issues.

      --
      General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
    5. Re:In Academic Projects by parlancex · · Score: 1

      I wrote a project that was parsing text files that were several hundred megs in size, containing large numbers of floating point numbers in text in a reasonably complex structure. This all needed to be parsed and converted into simple data structures for processing. The initial version using STL streams for parsing and text manipulation was about 500 times slower than crawling bytes with switch statements and using standard C number parsing functions. 500.

    6. Re:In Academic Projects by Anonymous Coward · · Score: 0

      std::container

    7. Re:In Academic Projects by Bryan+Ischo · · Score: 1

      Yes, but ... should you really have to? What kind of container class implementation doesn't recognize the problems inherent in fragmentation and avoid them already?

    8. Re:In Academic Projects by Anonymous Coward · · Score: 0

      All that proves is you don't know how to use the STL.

    9. Re:In Academic Projects by gbjbaanb · · Score: 1

      There used to be a special version of the STL for games, EASTL which had a different implementation optimised for memory mainly.

      So there's no reason not to use the STL, or a STL.

    10. Re:In Academic Projects by ajyand · · Score: 1

      3D animation of real world scenarios, object recognition in images and vidoes, ream time speech analysis. Using classes and templates is important for us so we can not use plain C. We need to be platform agnostic, hence C++ is the language of choice.

    11. Re:In Academic Projects by ajyand · · Score: 1

      Even in 3D graphics and image processing one can not afford the slow performance of STL. Imagine if a feature detection algorithm on a single high resolution image takes 20% less time without STL, one will go for it. Practically it takes at least one order of magnitude less time.

    12. Re:In Academic Projects by david_thornley · · Score: 1

      The C++ standard doesn't mandate memory fragmentation. Maybe somebody could write a better STL implementation.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  24. The truth about C++ by NapalmV · · Score: 1
  25. I don't like it by Anonymous Coward · · Score: 0

    As someone who is coming from learning C#, Java, and C++ as a student, then going on to use C++ in my first programming job ( 6 months so far), it is syntactically clunky, inflexible, debugging it is a chore and if you fuck up, you fuck up big time. Performance gains are negligible at this point, though I'm sure there is a lot of room for improvement.

  26. Re:Simple by Anonymous Coward · · Score: 0

    Hi there, have you been contributing to OpenSSL?

  27. Here is the fundamental problem... by Anonymous Coward · · Score: 0

    "They are always curious about what practitioners are doing these days." Those who can DO, those who can't TEACH. Get out and do some damned consulting, keep up on your industry, get your head out of your tenure and get into a job that makes you feed yourself on your skill in the field. Once you do that, then you have something valuable to teach. Other than that, you are just regurgitating someone else's opinions on things. Get some experience and make your lessons valuable to your students. By the way, I adjunct teach and my students ask the same things. I can actually answer them intelligently. I can give them a real-world example of the how's and why's of what I am teaching them in. With any guaranteed job, you stagnate in your knowledge to what is on the resume you were hired with. Tenure is the problem.

  28. Standard Library is both a strength and weakness by PhrostyMcByte · · Score: 5, Insightful

    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#.

  29. I never cared for STL by Whammy666 · · Score: 0

    I never cared much for STL. I don't find it all that useful. But I grew up learning programming thru assembly language and later plain-old C, so I'm biased towards keeping the languages at their core without the window dressing. There just isn't anything in STL that I can't replicate quickly using basic C/C++. It avoids a lot of compatibility/portability issues as well.

    --
    When all else fails, run.
    1. Re:I never cared for STL by Anonymous Coward · · Score: 0

      >There just isn't anything in STL that I can't replicate quickly using basic C/C++
      Bullshit. Go implement a cross platform map library that has pluggable allocators and can use arbitrary comparison functions. I'll wait.

      >It avoids a lot of compatibility/portability issues as well.
      You're an idiot. The standard library uses standard c++. If it's not running on your compiler (what, VC6?) then your compiler isn't a c++ compiler.

    2. Re:I never cared for STL by Whammy666 · · Score: 2

      Staying with rudimentary C/C++ gives you cross-platform compatibility. And it may come as a surprise, but there are still a lot of legacy systems out there that don't have the latest and greatest C++ libs. As for map libraries, you think those didn't exist before STL?

      --
      When all else fails, run.
    3. Re:I never cared for STL by Anonymous Coward · · Score: 0

      What's C/C++? Is that a new language?

    4. Re:I never cared for STL by Anonymous Coward · · Score: 0

      must be.

    5. Re:I never cared for STL by Darinbob · · Score: 1

      C++ is a religion, and STL is one of its major sects, as you can tell by the ridiculous arguments that break out.

    6. Re:I never cared for STL by Anonymous Coward · · Score: 0

      As for map libraries, you think those didn't exist before STL?

      Why were libraries needed if the functionality is quick to implement with basic code?

    7. Re:I never cared for STL by Anonymous Coward · · Score: 0

      Feel free to not use any standard element in your own code. Of course, the main benefit of the STL is that it is standard. Pre-STL everybody had their own implementation of a linked list or a vector. Writing such a data structure in such a way that it remains flexible and useful is no mean feat.

    8. Re:I never cared for STL by foksoft · · Score: 1

      Unfortunately your approach brings one important compatibility issue. It is code - programmer compatibility. When you use STL or other standard library you can bring a new programmer to your project and he would't have much problem to understand the code. But don't use it and the new programmer would have to learn not only your code but your super highly optimized containers too. And I bet that your library wouldn't come with as good documentation as STL.

  30. The more C++ evolves... by Torp · · Score: 0

    ... the more I like other programming languages.
    I'm sorry but all this "everything can be solved with a few more templates" mindset plus the feature creep remind me of only one thing: cancer.

    --
    I apologize for the lack of a signature.
    1. Re:The more C++ evolves... by grub · · Score: 3, Funny

      C++ is to C as Lung Cancer is to Lung.

      --
      Trolling is a art,
    2. Re:The more C++ evolves... by Anonymous Coward · · Score: 0

      You know my father died of C++...

    3. Re:The more C++ evolves... by Anonymous Coward · · Score: 0

      yep, that seems about right.

  31. I like it by Anonymous Coward · · Score: 0

    I actually took Stroustrup's advice and relearned C++11 as a programming tool in it's own right rather than just C with more features, and I've become much more productive, my code is smaller, faster, and more demonstrably robust, and life is generally easier, except for the part where I sometimes work with people who do not. C++11 and beyond make me happy; I like using them, and I no longer worry about the future relevance of the skills I'm using now.

    1. Re:I like it by geminidomino · · Score: 1

      How'd you manage to do that? A sincere question.

      In all my years of coding, I've never been able to "un-taint" my mindset, so learning any new language has always boiled down to either "learning it like C, but <differences>" or "learning it like perl, but <differences>"

  32. Agreed by Viol8 · · Score: 3, Insightful

    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.

    1. Re:Agreed by serviscope_minor · · Score: 2

      They added far too many features to the language in order to please everyone. Why?

      Languages grow over time and change as the world changes. What was adequate in 1980 is not in 2014. Nonetheless, I can't think of a single feature that C++ could do without.

      People who need high level languages have plenty of others to choose from.

      Such as? There are very few languages out there that have the combination of expressiveness, speed and stability of C+

      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, I can't think of a single one.

      How is that getting sick of it? That sound like using the features in appropriate ways. Just because templates give you the STL is no reason to go nuts with them.

      --
      SJW n. One who posts facts.
    2. Re:Agreed by Anonymous Coward · · Score: 0

      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.

      No one's forcing you to use those features.

    3. Re:Agreed by davecb · · Score: 2

      Anonymous

      No one's forcing you to use those features.

      Regrettably, you have to navigate around using them: It's like a control panel with the 40% of the buttons you push spattered among the 60% you don't.

      Or, more precisely, the statements you know the grammar for are only 40% of what are in in the recognizer. The program that's trying to read your input and sort it into correct and erroneous now has a much greater chance of mistaking an error for a valid statement in the language.

      Guess what happens when you say do 10 i=1.5 instead of do 10 i=1,5 in FORTRAN. Syntactically correct, but not what you meant to say!

      --
      davecb@spamcop.net
    4. Re:Agreed by crunchygranola · · Score: 1

      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.

      No one's forcing you to use those features.

      In a world where you only wrote your own code from scratch for your own use would that be true.

      Very, very few developers live in that world. Most work is done by software teams which maintain and extend legacy systems, where a legion of programmers have come before you. Any feature that any of those programmers use/used, and has not yet been stripped out of the code base, you are indeed forced to use as well.

      --
      Second class citizen of the New Gilded Age
    5. Re:Agreed by Anonymous Coward · · Score: 0

      "Regrettably, you have to navigate around using them: It's like a control panel with the 40% of the buttons you push spattered among the 60% you don't. "

      Eh? What on Earth is that meant to mean? You don't have to "navigate around" using anything. Program C++ as if it's C if that floats your boat, you'll find that the very vast bulk of your code will compile perfectly happily with C++11 compliant compilers.

      I've got absolutely no idea what your bonkers Fortran example has to do with anything. Hey! Guess what happens if you say for ( int i = 1.5; ++i ) in C or C++!!!!!! LOLZORZ!!!!!!!!

      Seriously, your argument is that if you get the syntax wrong you've got a problem, therefore C++11 is impossible to use because you might lose yourself and accidentally type

      template
      void StupidBloodyMethod(const Type* arbitraryInput) { std::cout arbitraryInput; }

      ? Bloody hell, man, do your fingers run away with you that often?

    6. Re:Agreed by Pseudonym · · Score: 1

      Nonetheless, I can't think of a single feature that C++ could do without.

      The standard library implementation of locales.

      Oh, you meant the language, not the library? Protected inheritance, then.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    7. Re:Agreed by serviscope_minor · · Score: 2

      No idea if you're still reading but...

      Oh, you meant the language, not the library? Protected inheritance, then.

      Well, one *could* attempt to justify on the grounds that visibility in-calass has 3 options, so why reduce it to two for inheritance... But yeah. I doubt anyone would notive if that feature disappeared.

      Actually scratch that: there's probably enough nutcases out there using it because it exists. I doubt anyone writing any code that could be considered good by any measure at all would miss that little gem if it quietly disappeared.

      --
      SJW n. One who posts facts.
    8. Re:Agreed by Pseudonym · · Score: 1

      Yeah, its only justification for existing is that it would probably be more effort to disallow it.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
  33. Amazed at all the negative responses by Anonymous Coward · · Score: 1

    I liked STL then and I like the upgrades more now. Any project worth doing in C++03 is absolutely worth doing in C++11 if your compiler can handle it. C++11 is almost a superset of C++03, and the few places where it isn't are trivially fixed (e.g. auto is now a type specifier instead of a storage specifier). Nobody used auto in its old sense anyway.

    Overhead is low enough that if you could justify doing the project in Java/Ruby/Python, you can absolutely tolerate the runtime overhead of well written C++ instead. Development overhead varies widely based on your developers' experience with the choices available. Don't send a Ruby user to write C++. Don't send a C++ developer to write Ruby.

    STL containers are the best choice to use if your data structure needs fit with the STL design. Don't try to force-fit your internal representation just so you can use an STL container, but don't roll your own container to duplicate an STL one. The chance you'll beat the STL at its own game varies based on whose STL you use (Apple, Microsoft, or GCC libstdc++), but your odds aren't good for any of them, and anywhere you win will probably be overshadowed by the flexibility you lose. With vendor libraries, if you want to turn on exhaustive debug checks of container access, set a vendor-specific flag to build with the checking version of their library. If you roll your own container, now you either give up the existence of the checking build or you have to write the checking version too. If your custom container deviates from STL conventions, some STL algorithms may work poorly, if at all, with your container. Before rolling your own container, think whether you really need the minute speed boost you will get or if you would be better off adjusting the algorithm and/or data structure.

    STL provides containers for most of the common purposes. Need a fixed-size array with known length? std::array. A heap-backed auto-resizing array? std::vector. A bidirectional linked list? std::list.

  34. I think it's great by Stele · · Score: 5, Insightful

    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.

    1. Re:I think it's great by Threni · · Score: 1

      Do you use any parts of Boost instead of what's in the standard library, or just the stuff that's missing? Care to explain? (I'm learning C++11 (having not used C++ too much over the last few years) so I'd find it a useful heads up.)

    2. Re:I think it's great by Stele · · Score: 1

      To tell the truth the only thing I'm still using from boost is intrusive_ptr (an intrusive reference-counted smart pointer), which I use practically everywhere to help automate memory management and make integration with Python easier.

      But with boost you can mix/match as needed, and use only as little of it as you need.

      Transitioning some of the os-centric stuff (like threading primitives) from boost to C++11 just avoids having to add boost to your dependency chain. It's nice to only have to rely on what's in the language or the standard library, since you'll know it'll always be there - and presumably, is as efficient as possible.

    3. Re:I think it's great by Threni · · Score: 1

      Ok, thanks. I'm currently working my way through the new Stroustrup book and I'll bear that in mind.

  35. 1M lines? Really? by Viol8 · · Score: 2

    Over the course of 10 years that would be about 270 lines a day 7 days a week, 52 weeks a year. Including debugging an testing? I don't think so my friend.

    1. Re:1M lines? Really? by Anonymous Coward · · Score: 0

      They did a lot of copy/paste back in the day.

    2. Re:1M lines? Really? by Anonymous Coward · · Score: 0

      Maybe he is generating those lines from a higher language like http://nimrod-lang.org. I can tell you I use http://smc.sourceforge.net (a java program) to generate C/ObjC code.

    3. Re:1M lines? Really? by Jizzbug · · Score: 0

      It is conceivable for a developer to write thousands of lines of code in a day when on a roll.

      --

      -=/\- Jizzbug -/\=-
    4. Re:1M lines? Really? by Viol8 · · Score: 1

      And then spend weeks testing and debugging it. It all evens out in the end. Even the most prolific coder would have trouble writing a million lines of code in this sort of time period. Maybe over the course of an entire career perhaps.

    5. Re: 1M lines? Really? by O('_')O_Bush · · Score: 1

      It depends on what he was working on, I guess. A lot of interface code is super verbose, super copyable, super fast to produce, and low in bugs. It is also super thoughtless, which is why developers like myself don't count that kind of code.

      But certainly, working in an environment where the codebase is tens of millions of lines with 50+ developers that has been growing for approaching 20 years, the expectation is that, on average, a developer only produces a few SLOC/hour when testing/debugging/review/documentation are taken into account.

      Skipping the review/documentation bumps that number up to, maybe, a dozen SLOC/hour, but only in some circumstances and some tasks that developers are churning out 1k+ lines/day. Just doesn't happen that way most of the time.

      --
      while(1) attack(People.Sandy);
    6. Re:1M lines? Really? by DoofusOfDeath · · Score: 4, Funny

      They did a lot of copy/paste back in the day.

      And even that is a better implementation of Templates than C++'s.

    7. Re:1M lines? Really? by Anonymous Coward · · Score: 0

      270 lines a day -- script kiddie. In the 70's we easily wrote > 1000 lines/day (10 hrs/day was typical) - and not saying they all worked first time. Recall that one line of code could be "int i;" so don't be stupid about this claim. I worked on a project for 4 years with 2 other devs - 6M lines of code (excluding comments) - so that's, uh, 2M lines each - WOW!

    8. Re:1M lines? Really? by Anonymous Coward · · Score: 1

      Why would one spend weeks debugging code? If one does complete systems, which does not interface everywhere to a 3rd party code with unknown "features", the amount of bugs can be really low. And if the code is written properly using assert():s from ground up, it almost tests itself. A good coder is easily ten times as more efficient than bad one.

    9. Re:1M lines? Really? by brausch · · Score: 1

      I think it could be true. I wrote over 200,000 lines of C in one three year burst in the early 90s. A multi-tier client server thing, everything from user interface to SCSI control code. It is running still in production 20 years later. So a million lines in a decade is at least feasible.

      --
      "Almost every wise saying has an opposite one, no less wise, to balance it." - George Santayana
    10. Re:1M lines? Really? by umghhh · · Score: 1

      maybe all these 270 lines per day just worked so no need to test etc.

    11. Re: 1M lines? Really? by Anonymous Coward · · Score: 0

      How is it better? (An honest question.)

    12. Re: 1M lines? Really? by disambiguated · · Score: 2

      Well, with copy/paste templates, you can understand the error messages. With C++ templates, the error messages are each kilobytes of jibberish, written in a strange dialect of lisp using angle brackets instead of parentheses.

      Also, you don't need half a whiteboard to write the full name of a type.

    13. Re:1M lines? Really? by StripedCow · · Score: 1

      He was probably talking about lines of assembly code (after using the -S switch to gcc).

      --
      If Pandora's box is destined to be opened, *I* want to be the one to open it.
    14. Re: 1M lines? Really? by DoofusOfDeath · · Score: 1

      How is it better? (An honest question.)

      What I wrote was mostly just trying to be funny. But not entirely.

      The problem I have with C++ templates is that their resolution process can be very complex. But the compiler generally treats the resolution process as something that you the programmer cannot watch unfold. It can be just as complex as how the software you're writing is meant to behave at runtime, and yet we have almost no tools to trace the resolution process's execution.

      And then, it's potentially interacting with other opaque C++ compile-time processes: operator overloading (including implicit type casting), overloaded functions, default arguments, and substitutions via typedef and/or #defines.

      The net result is that you can have wildly complex set of rules coming into play at compile-time, and with only crypgraphic-quality error messages if something goes wrong. Or, if you're unlucky, no error messages, but you misunderstand what's going to happen at runtime.

      Even if you're using its compile-time features (overloading, templates, typedefs, etc.) in a reaonable manner, wo be to anyone who writes code where those features significantly interact with each other.

      This is why many of us long-time C++ programmers discipline ourselves to use the language in a fairly restricted manner. My normal rules of thumb are:
      - No operator overloading, especially type casts.
      - Templates are mostly used for container classes, or in rare cases algorithms.
      - Spare use of method/function overloading.
      - Try to use template parameters that are themselves of as simple of a type as is practical.

      Also, given C++'s potential headaches, I'm leaning more towards using it only in performance-critical parts of my programs, preferring Python and/or Java for the parts that can be slower. And honestly, once you get to that point, the reasons for using C++ rather than C or Fortran start to melt away in many cases.

    15. Re: 1M lines? Really? by GiganticLyingMouth · · Score: 1

      My normal rules of thumb are: - No operator overloading, especially type casts. - Templates are mostly used for container classes, or in rare cases algorithms. - Spare use of method/function overloading. - Try to use template parameters that are themselves of as simple of a type as is practical.

      Some operators shouldn't be overloaded (e.g. &, && and ||), but good luck writing any non-trivial container classes without overloading the assignment operator. You may think you're not overloading these, but the compiler is simply auto-generating them for you since you didn't provide one (namely, copy-assignment operator and move-assignment operators). As with any language feature it can be abused, but they can be quite useful when used judiciously. (i.e. if you're writing a Matrix library, you'll probably want to overload the arithmetic operators).

      It's true that there are pitfalls to using templates, but I think you're grossly overstating their dangers (while ignoring all their benefits). You can do some pretty amazing things with templates; in the least they reduce code duplication, and at best they allow compile-time polymorphism, better error detection, and a whole different paradigm for using C++ (metaprogramming can pretty closely resemble functional programming).

    16. Re:1M lines? Really? by Viol8 · · Score: 1

      BS. Back under your bridge.

    17. Re:1M lines? Really? by carys689 · · Score: 1

      Bragging about the number of lines of code that one writes is not a virtue.

    18. Re:1M lines? Really? by brausch · · Score: 1

      :-) Wasn't trying to be virtuous. Merely sticking up for the first poster.

      --
      "Almost every wise saying has an opposite one, no less wise, to balance it." - George Santayana
  36. Franken-monster by countach · · Score: 4, Insightful

    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.

    1. Re:Franken-monster by RandCraw · · Score: 1

      Like VB.net. I've never seen a tidy simple language morph into anything so monstrous. C++ comes close, though.

      Frankenly, I'm forever amazed at how low the standard is for programming language enrapture. I'm sure it's due partly to 1) a lack of experience with other languages, and 2) a lack of imagination.

      Sadly, I suspect the biggest source of this pathology is that most programming tasks are mindblowingly dull: load/unload a form, query a RDBMS, check for bad data, etc). Developers inevitably want a way to spice up deadend tasks like these (which admittedly is a better response than suicide). So they willing adopt / invent wildly overcomplex tools in the hopes that their humdrum existence will gain meaning. Or distraction at least.

      Many less mainstream languages are *far* smaller, more legible, and sufficiently expressive as those at the Top of the Pops (e.g. C++, Java, Python), but they don't receive the needed mindshare (or libraries) needed to compete. Perhaps they just need their syntax to be a *bit* more Kafkaesque. (So what *is* Larry Wall doing these days?)

      Or I suppose they could just add pointers...

    2. Re:Franken-monster by Anonymous Coward · · Score: 0

      I'd rather work on a project that used two different languages with different purposes -- e.g., Scheme and C -- than work on a project with a kitchen sink language. My fear is that even C will become a kitchen sink language, as that seems to be the trend.

    3. Re:Franken-monster by Anonymous Coward · · Score: 0

      "Languages that aren't designed top to bottom at the beginning tend to evolve into Frankensteins."

      Any language that is designed from top to bottom at the beginning is only completely useful at the beginning and its usefulness degrades with time.

      You either build a way to adapt to emergent usefulness into the language from the beginning, or youre building a toy to be used by CS students.

    4. Re:Franken-monster by frank_adrian314159 · · Score: 1

      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.

      Yeah, but it has parentheses. To some folks that makes it seem almost as bad as socialism!

      --
      That is all.
  37. Re:Simple by Stele · · Score: 1

    Okay, I'll bite.

    What overhead, specifically?

  38. C is still poor at reuse and modularity by bzipitidoo · · Score: 2

    The reusability and modularity of C and C++ has always been poor, and, though improved, still is. C is good for making your own linked list functions, not so good for using libraries containing those functions. We've persevered in spite of that, and created hundreds of libraries in C. But it's still a mess.

    The STL is fine as far as it goes, but, for example, it simply cannot integrate something like Perl's hashing abilities and regular expressions as well as Perl itself. The programmer can sort of approach the cleanliness of the Perl syntax by making clever use of C++'s operator overloading, but among the problems with that is that there are a small number of operators available for overloading. The programmer cannot create new operators. Better to retreat to the messy function call syntax. That is, instead of something like c=a+b; it's c=add(a,b);

    And the function call syntax has its own limitations. Unless the coders include the library for variable numbers of parameters (printf being the go to example of such a function), they're stuck with fixed numbers of parameters. Having to do prototyping is another annoyance. Surely computers have progressed to the point that it is not a huge imposition to ask a compiler to make 2 passes through the source code, or store the data types of the parameters of a call to an as yet unknown function, to resolve forward references itself instead of burdening the programmers with that chore? But even if those 2 limitations are addressed, calls are still like having to do math with prefix notation and still be forced to use parentheses everywhere even when the number of parameters are fixed, rather than a choice of prefix, infix, or postfix notation with some operator precedence so that it isn't necessary to surround absolutely everything with parentheses. In that respect, C is no advance at all over Lots of Irritating Superfluous Parentheses.

    Another resuability problem was name collision between different libraries. Two libraries with a "sort" function, for instance. To deal with this, it became the custom to prepend the library name to every function name. Now we have namespaces.

    --
    Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
    1. Re:C is still poor at reuse and modularity by jandrese · · Score: 1

      The programmer can sort of approach the cleanliness of the Perl syntax

      There's a line I was not expecting to read today.

      --

      I read the internet for the articles.
    2. Re:C is still poor at reuse and modularity by bzipitidoo · · Score: 1

      Yes, I know Perl is thought messy thanks to sigils and dense regular expressions. But the hash syntax is positively clean compared to how C++ has to do it: $h{key}=value, vs something like h.add(key,value);. And C? Even worse with something like hash_add(&h,key,value), unless the programmer knows how to work with pointers to functions, and wants to use that to make the code more like C++.

      Or think of it this way. C is so bad that it makes Perl look clean and neat.

      --
      Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
    3. Re:C is still poor at reuse and modularity by jandrese · · Score: 1

      I would think the hash handle would already be a pointer in most cases. So it's hash_add(hash, key, value). More keystrokes than the Perl version for sure, but not exactly razor blades to the eye. Not like what happens in Perl when you try to create complex data structures and pass them to functions. Granted, that same problem isn't a picnic in C either, but C is better at keeping a lid on the exploding syntax and is a lot easier to grok from just looking at the code. I weep for a perl newbie who is asked to deal with a reference to a hash of arrays. The syntax isn't particularly difficult, but it's very unintuitive.

      --

      I read the internet for the articles.
    4. Re:C is still poor at reuse and modularity by bzipitidoo · · Score: 1

      not exactly razor blades to the eye

      Ah, but it is bad. Maybe not razor blades, Cobol, or XSLT, but bad enough. When there is or could be a more succinct, clearer way to express something, it quickly becomes tiresome to use an inferior method. Even if that inferior method is only a very little inferior, even when the extra syntax seems small and trivial, it's still bad.

      One problem with hash_add(hash,key,value) is that the parameter order is arbitrary. The function could as easily have been written to take the parameters in another order, like hash_add(key,value,hash). Consider fprintf() and fputs(). The programmer cannot tell which order is correct without some external reference, be that documentation, the source code, or memory. Another problem is that we know the function takes 3 parameters. For a fixed number of parameters, there is no need for parentheses, except that C needs them to distinguish function names from variable names. The parentheses are in fact sigils, making C no better than Perl. Otherwise, the C code could be hash_add hash,key,value;

      I never had much trouble combining and passing large data structures around in Perl, but then I was already a veteran C/C++ coder when I began working in Perl. Sometimes I would use a print statement to check that I was passing what I wanted to pass. But yes, newbies would struggle, much like they struggle with the infamous C pointer syntax. I could instead use Python, if you like.

      --
      Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
    5. Re:C is still poor at reuse and modularity by Anonymous Coward · · Score: 0

      You do realize that function prototyping is a super useful self-documentation technique, right?

    6. Re:C is still poor at reuse and modularity by Anonymous Coward · · Score: 0

      But the hash syntax is positively clean compared to how C++ has to do it: $h{key}=value, vs something like h.add(key,value);

      You can easily make h[key]=value work with c++ classes.

    7. Re:C is still poor at reuse and modularity by david_thornley · · Score: 1

      Correction: the C++ way to add a value to a hash table (unordered_map in C++ standardese) is h[key] = value;. Slightly better than the Perl syntax, I think, particularly since there's no confusion between [] and {} or $ vs. %.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  39. Re:Simple by Anonymous Coward · · Score: 0

    Overhead compared to what ? Not doing things at all ?

  40. Performance? by Frankie70 · · Score: 1

    Can you point to an example of how your container is more performant than the STL?

  41. Re:Simple by Anonymous Coward · · Score: 0

    And why is that? Why give up references and other useful C++ improvements just because you aren't going to use STL?

  42. Delayed. by Chatsubo · · Score: 2

    In production software you don't always have the luxury of being able to switch to the latest and greatest in an instant.

    In the case of C++(and others) as things change you have to update compilers, this often(read: always) means stricter requirements as the compilers improve (IOW: Newer compilers catch potential problems in your code better than older ones, and moan about it more). When you have a system of millions of lines of C++, this means you have to dedicate manpower (which you probably need somewhere else) to fixing all these "new" issues before you can upgrade all your compilers. This is good, but you can't always dedicate 100% of your time to it. Aside: For our stuff we turn warnings-as-errors on always, which maybe makes this task more difficult than it is for others, but we get to catch bad code a lot quicker.

    My team only recently got to the point where all our stuff was in a state that we could start using the newer compilers and hence, standard. But we've been chomping at the bit to use C++11 for a long time. So yes, I do care. And yes, I think it's much better now.

    Why do we care?
    For one, lambda's make our lives, and code readability, SO much better. Especially when using the std algorithms.
    We will definitely be utilising variadic templates in our shop as we tend to be template meta-programming heavy. We avoid re-work like a plague.
    Personally I'm glad to see the new initialiser lists because we also stress TDD and nothing sucks more than not being able to set up test data easily and have it be readable. Almost always requires some instrumentation first.

    --
    > no, yes, maybe (tagging beta)
    1. Re:Delayed. by DoofusOfDeath · · Score: 1

      We will definitely be utilising variadic templates in our shop as we tend to be template meta-programming heavy. We avoid re-work like a plague.

      There's a veritable chorus of people, me included, who would warn you away from Template Hell, based on personal experience.

      Avoiding rework is nice, but not when your "extensible" solution relies on language / compile-time behavior that's so complex it takes you 10 times as long to get right in the first place, let alone maintain.

    2. Re:Delayed. by GiganticLyingMouth · · Score: 1

      The "complex" rules for templates are laid out in painstaking detail in the standard. There can be surprising interactions with other language features(e.g. explicit template function specialization), but (based on personal experience), after having encountered them once or twice, you learn about them and avoid them in the future. On the other hand, having what would otherwise be runtime errors reported at compile time saves time on debugging, and generates more robust code.

    3. Re:Delayed. by DoofusOfDeath · · Score: 1

      Right, my plea was against the overuse / misuse of templates, not against using them at all. Sorry that wasn't clear.

  43. Swiss Army Knife, huh? by Anonymous Coward · · Score: 0

    Could you be referring to this?

    1. Re:Swiss Army Knife, huh? by MadKeithV · · Score: 1

      That's pretty much exactly what I was thinking of yes. But then using it as a hammer 90% of the time.

  44. too heavy, too unreliable... at least for my uses by Teunis · · Score: 1

    The few experiments I've tried with STL have been a bit too heavy and slow - at least with my uses which are frequently not single threaded.
    My last test ran faster in python.

    so I'll stick with C. Good old efficient, manageable and predictable C.

    However I hear the STL is great for many people.

  45. The STL is dramatically better now by File_Breaker · · Score: 2

    I have been working with C++ (as well as Java, C# and other languages) for several projects over the past 13 years. Since C++ is still the main language for the projects I'm paid to work on, I find the improvements to the STL useful every day in avoiding doing custom things. We used to have our own class similar to std::shared_ptr and std::unique_ptr, which we have since replaced with the standard. With std::bind() we have reduced the complexity of many of our functions. As another commenter said, the lambda functions are great. I'm not sure why there is so much hate for C++. Having worked with both C# and Java on several projects, I still think our C++ projects have the cleanest code and have the best performance before tweaking. I am one of the few developers that bounces back and forth between languages so I don't think it is a case of C++ people trying to write C# or Java, the people writing C# and Java are developers who write those only.

    1. Re:The STL is dramatically better now by frank_adrian314159 · · Score: 0

      As another commenter said, the lambda functions are great. I'm not sure why there is so much hate for C++.

      Well, let's take your example of lambda functions. They were used mathematically back in the late 50's. Other programming languages had them as part of the language since the early 70's. And now we're supposed to cheer because we have a version with a crappy syntax only a C++ committee could love that adds more interactions with exception handling, memory allocation, and just about every other poorly designed feature that was or will be shoehorned in because the language wasn't designed right in the first place?

      Thanks, dude. I'll take Javascript any day. At least there I don't have to deal with much more awful than conflation between strings and numerics, a crappy numeric stack, and constructors that masquerade as functions at bad times. And I get prototypical objects as a bonus. Fuck it. I'll take a 1970's era Lisp compiler that will get me to within 30% of C++ speed or (if I write some C or assembler primitives) faster.

      Face it. C++ is about as 1980's as you can get in PL design. It looks like a whore that puts on more makeup each year when, in reality, it's giving $5 blowjobs in a back alley because then you don't have to look at its ugly face.

      It's time for it to go away. But at least you can rest happy that it will stick around forever thanks to folks like you who have continued to use this ugly, perverse language.

      --
      That is all.
  46. I use it, love it. by mrthoughtful · · Score: 2

    We just migrated our codebase from C++ STL to C++11 and in general, it was worth the pain.
    The main benefits for us were better awareness of modern character encoding - but stuff like lamda functions are pretty cool too, and we could probably tidy up a lot of our earlier code to use more C++11 features.

    I was brought up on Assembler (Z80, 680x0) and moved to 'C', and then migrated to 'C++', so my early C++ was very C-like (not unusual). However, I've not looked back. I know that you are asking about C++11, but C++ itself is probably worth highlighting.

    I also know Java, Obj-C, (and a bunch of other languages that I have used in less commercially sensitive contexts) and there's a lot to be said for them too. But when I feel like getting close to the metal, it's C++ for me. I guess it's b/c one can still (just about) follow the assembler generated by it.

    But then I'm old in my approach. Modern optimising compilers, with coding strategies, static analysis (as well as excellent IDEs) probably have more effect on my productivity than any language sub-variant.

    --
    This comment was written with the intention to opt out of advertising.
  47. I love templates I hate templates by EmperorOfCanada · · Score: 4, Insightful

    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.

    1. Re:I love templates I hate templates by serviscope_minor · · Score: 3, Insightful

      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.

      --
      SJW n. One who posts facts.
    2. Re:I love templates I hate templates by fulldecent · · Score: 2

      This reminds me of factory factory factories:

      http://discuss.joelonsoftware....

      --

      -- I was raised on the command line, bitch

    3. Re:I love templates I hate templates by EmperorOfCanada · · Score: 1

      That is why I dumped Java around a decade ago. It was getting worse and worse.

    4. Re:I love templates I hate templates by Esben · · Score: 1
      Well, I guess you will say I am one of them. But I still feel it makes sense to use templates in more than a core library or STL.

      Quite often I define a method as a template over one of the parameters. Then as it calls another method etc I can specialize. Forinstance, if I have class hiracy with Object at top, I could write a method called foo(Object *obj) {....} , or template foo(Obj *obj) { ... bar(obj); .. }. Now I can compiletime specialize over the type of object depending on where I come from.

      Another examble is building classes consisting of one of more objects, which will differ. Doing it the OO way, you will need to do class Foo { Interface *mSomeObject; .... };, whereas with templates it becomes template class Foo { SomeObject mSomeObject; ....}; Thus template saves you an indirection and virtual function, but still leaves your code open to generalize. Thus I build up both type heracies and specializations by templates. Without it you will need references to a interfaces and lots of calls to virtual functions.

    5. Re:I love templates I hate templates by Darinbob · · Score: 1

      Which is why last time I was at a company that used C++, everyone came to me to decode the error messages, unravel the templated mess, debug the code, and so forth.

  48. Political comparison by DoofusOfDeath · · Score: 1, Funny

    I feel the same way I feel about having voted for Obama.

    1. Re:Political comparison by Yunzil · · Score: 2

      It's better than any of the alternatives?

  49. It's still a mess by beelsebob · · Score: 1

    It still has a billion and one corner cases to deal with. C++ does not need more stuff added to try and cover up the cracks, it needs a complete rethink of how to target the market needing high performance type safe programming.

    Thankfully Rust is targeting this, and has far less cruft involved.

  50. C++ admits it is too complex with "auto" for types by Anonymous Coward · · Score: 0

    Now you really have to think about this one, but ...

    By introducing "auto" for types, C++ has admitted that it is too complex for human beings to understand. The "auto" type declaration means that only the compiler can figure out what to put for a new type. By using it, the programmer is saying "I have no idea what to put here, so I implicitly trust the compiler to do it for me."

    This is similar to the IDE. Something like C# or Objective-C is so complex that it is collapsing under its own weight, so the solution is to give programmers an IDE that hides the broken mess of ad-hockery from the programmer. By giving programmers Xcode or Visual Studio, a company is admitting that their development tools are so complex that they can't understand or fix them. All they can do is put a band-aid over them in the form of an IDE.

    The introduction of these crutches shows programming is getting too complex for human beings to understand.

  51. No C++11, little STL by JohnFen · · Score: 2, Interesting

    I work as a software engineer for a major software company. We do not use C++11, and likely won't start for years. Due to the existing code base, changing up tools is a costly and dangerous thing to do and it is never done unless absolutely necessary.

    STL is something of an abomination. Good intentions, and we do use some of it, VERY sparingly, but generally speaking it makes code more difficult to understand and maintain.

    1. Re:No C++11, little STL by Esben · · Score: 1
      Do you make your own list, vector etc?

      I have done so as for special cases, but in most cases stl works just fine. In the past it has been buggy but that was 10-15 years ago - and more so in embedded environments.

    2. Re:No C++11, little STL by coolsnowmen · · Score: 1

      Can you give an example of something you feel you did better ( more maintainable? ) than is done in STL? Containers? Algorithms? In general, using STL is more maintainable because c++ programers know it, so bringing someone onto a project doesn't require re-training them to use your home grown code base.

    3. Re:No C++11, little STL by david_thornley · · Score: 1

      Strange. We worked to keep our codebase clean, and have no problem just working C++11 in. Most of the virtual functions have "override" on them now, and we found and fixed some hierarchy bugs while doing so.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    4. Re:No C++11, little STL by JohnFen · · Score: 1

      No, we use different libraries for this.

      STL can do it just fine. The problem with STL is primarily syntactic. If too much is being used, it becomes rather difficult to decipher what the code is actually doing.

    5. Re:No C++11, little STL by JohnFen · · Score: 1

      The reason we aren't using C++11 yet is because we have to change our toolchain to do it, not because of anything to do with C++11 itself. Changing the toolchain is a costly proposition, and is only done when the opportunity permits (new products) or if there's an extremely good reason to do so (security, typically).

  52. Re:Simple by LWATCDR · · Score: 1

    On a PC I would say everyone. On embedded it is not always an option. Even some ARM SoCs do not come with GB's of ram. Heck sometimes even c++ has too much overhead and you use c.
    I do not see why so many people are bent by my statement. I happen to work a company that does a lot of works with M0, M3, and 8051 MCUs as well as Windows, Android, IOS, and Linux systems. On a PC I would never worry about using STL on an M0 or M3 I would, and on an 8051 I wouldn't even use c++.

    --
    See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
  53. Re:Simple by LWATCDR · · Score: 1

    The library size for one. I happen to work at a company that works with MCUs like the M0 and M3, STL is a bit heavy for those. Forget about the 8051s we use for BLE. Not every program works on X86 based PCs running Windows, OS/X, Linux, BSD or some other OS.
    I do not see why anyone is getting upset over my comment.

    --
    See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
  54. same holds true for any language by Jizzbug · · Score: 0

    especially C

    --

    -=/\- Jizzbug -/\=-
  55. Re:Simple by mkremer · · Score: 0

    C99 pulls many of the non-object usefull C++ improvements in like references.

  56. STL issues... by wiredog · · Score: 5, Interesting

    From Page 3 of this:

    The C++ STL, with its dyslexia-inducing syntax blizzard of colons and angle brackets, guarantees that if you try to declare any reasonable data structure, your first seven attempts will result
    in compiler errors of Wagnerian fierceness:


    Syntax error: unmatched thing in thing from std::nonstd::_ _map<_Cyrillic, _$$$dollars>const basic_string< epic_mystery,mongoose_traits < char>, _ _default_alloc_<casual_Fridays = maybe>>

    1. Re:STL issues... by Anonymous Coward · · Score: 0

      And right after that:

      One time I tried to create a list>, and my syntax
      errors caused the dead to walk among the living.

    2. Re:STL issues... by Anonymous Coward · · Score: 0

      Who modded this Insightful?
      Not disputing parent's insight. But it's Funny. +5 Funny. Can't you people read, or did you not get the joke?

    3. Re:STL issues... by DoofusOfDeath · · Score: 2

      Who modded this Insightful?
      Not disputing parent's insight. But it's Funny. +5 Funny. Can't you people read, or did you not get the joke?

      Hmmm... if only something (like a post) could have more than one attribute (like funniness and insightfulness) at the same time. Now that's a universe in which I'd want to live!

    4. Re:STL issues... by GiganticLyingMouth · · Score: 2

      If template error messages bother you, use Clang. It outputs much saner template error messages.

    5. Re:STL issues... by Anonymous Coward · · Score: 0

      Sincere thanks for the cathartic read at

      http://research.microsoft.com/en-us/people/mickens/thenightwatch.pdf

    6. Re:STL issues... by Threni · · Score: 1

      It would seem that the gap is closing, in terms of both the performance (of the compiler and the executables it produces) and the error messages:

      http://gcc.gnu.org/wiki/ClangD...
      http://www.phoronix.com/scan.p...

    7. Re:STL issues... by Anonymous Coward · · Score: 0

      Are you sure you weren't coding in Perl by mistake?

      Just kidding, even bad Perl is readable compared to that.

    8. Re:STL issues... by Anonymous Coward · · Score: 0

      I've been retired from doing VC++ for about a decade, and I had always considered Scott Meyer's "Essential C++" & "More ~" to be fantastic. However, when I got into his "Essential STL", I could believe how complex the error messages for the STL could get! With that said, I had only used a little bit of the STL - and then, only in a very simple manner - and I thought it was great

  57. Using C++11 and STL in Embedded by EMG+at+MU · · Score: 1

    In every project I have worked on it has been really important to try to write OS agnostic code. Some projects can afford a WinCE license, some projects would rather have a more stripped down RTOS type of thing so its really important to write as much code as possible without referencing the OS. C++11 makes that a bit easier with std::mutex and std::condition_variable. You get a platform independent mutex and with a little work a platform independent events/signal class (providing your target OS/compiler supports C++11, may don't yet). Also beware: Visual Studio 2012's c++11 implementation of std::condition_variable is buggy, they have fixed it in 2013.

    Furthermore, If you are working with the STL and algorithms you should really go over std::function and move semantics. std::function helps lambdas, functors, and callbacks look the same and all the sorted containers will accept a std::function as a predicate. Move semantics help avoid needless copies for objects that are on the free store.

    So as for practicality from one practitioner: Use of the cool new features of C++11 and the STL scare some people. I don't mean that offensively, it's not without merit. What I have experienced is that the amount of whining someone does about C++11 and the STL is a function of their age. Why? Because an inexperienced person may try to grow a vector in a interrupt or not understand what template bloat means, probably because they have never experienced missing interrupts or running out of codespace. Why is this caution bad? Because you can get a 1+GHz/256+MB SOC with nearly unlimited code space for less than $10. There still needs to be balance, and a good understanding of which threads are real time and which aren't, but an average dev can be much more productive using the STL and new features of C++11 than someone jumping through hoops to avoid using the STL.

    Personally, I don't like auto_ptr and would avoid the smart pointers. They are really cool in trivial applications but it is as easy to screw up mem management with auto_ptr as it is with naked pointers in more complicated situations (IMO YMMV).

    1. Re:Using C++11 and STL in Embedded by Cornelius+the+Great · · Score: 1

      Personally, I don't like auto_ptr and would avoid the smart pointers. They are really cool in trivial applications but it is as easy to screw up mem management with auto_ptr as it is with naked pointers in more complicated situations (IMO YMMV).

      I was with you until this. Having worked on large C++ with and without smart pointers and seeing the differences between the memory leaks firsthand has made me a believer in using smart pointers.

      There are shortcomings of the commonly taught RAII approach when handling raw pointers, mostly having to do with ambiguity of pointer ownership. Maybe not the auto_ptr itself (which has now been made deprecated in favor of unique_ptr due to having stricter move/copy semantics), but the smart pointers in Boost and C++11 are very strict about who owns the data in question. There are other things smart pointers can fix (such as automatic cleanups/refcount decrements with stack unwinding, which addresses leaks caused by unexpected thrown exceptions).

      Hell, simply having a ref-counted pointer that handles its own cleanup is a great way to ease developers who only have previous experience with garbage-collected languages into C++ development without introducing a ton of memory leaks or dangling pointers everywhere- not an ideal solution, but this crutch has saved us from many potential horrors introduced by senior developers who have only used C# or Java previously (yes, this is quite common today).

      --
      Sigs are for losers
    2. Re:Using C++11 and STL in Embedded by EMG+at+MU · · Score: 1

      Understandable.

      I understand the smart pointers benefit when it comes to exceptions. However we don't use exceptions. We write kernel mode stuff and really haven't found a use for them yet. They are awesome in other contexts.

      It would probably be beneficial for one of us to introduce smart pointers into the project for the other benefits, no one likes memory leaks.

      We also don't hire people who have only used C# or Java.

    3. Re:Using C++11 and STL in Embedded by Anonymous Coward · · Score: 0

      auto_ptr is deprecated now; does unique_ptr have the same problems?

  58. Still coding in C by Anonymous Coward · · Score: 0

    We're still doing all of the inner loop stuff in C so that timing is deterministic. STL being a little slower (it is) isn't the problem for us; it's that it's not really consistent enough for life safety critical systems. Oh, and we can't use it at all without a virtual memory machine.

  59. Re: Simple by Anonymous Coward · · Score: 0

    I was going to say the same thing. At my last place of work there were always "hotshot" developers writing "blazingly" fast and needlessly complicated code. I never once found a case where elegant use of C++11 couldn't compress the same behavior to 10% LOC, outperform their code and fix a few bugs in the process.

    The moral of the story; If you can use STL, use it. Ideally in the most simple, readable and straightforward way you can. If code is simple enough to understand at a glance and the underlying algorithms aren't bone headed, it's probably about as fast as it gets.

  60. Re:too heavy, too unreliable... at least for my us by MoonlessNights · · Score: 1

    This is generally what I have found, too.

    The best uses of C++ I have seen were simple and fast since they were really just vanilla C with classes.

  61. Re: Simple by Anonymous Coward · · Score: 0

    The question is often what you consider "overhead." Which in the embedded world is often memory, not speed.

  62. Why use it? by mattpalmer1086 · · Score: 1

    I had the most fun ever with C++ back when the original story ran. But it was too complex, too big and yet lacking standard ways of doing really very common things. Every library took a different approach. No standard libraries to do pretty much anything you wanted to in the real world. And it was always possible to shoot both feet off at once while doing something you thought was obvious and/or designed to make your code safer. Incredibly slow to compile. Compilers never supported the full C++ spec, or supported different bits of it on different platforms.

    The trouble is, I can't see any compelling reason to use it for anything much these days. Maybe the latest C++ is better - but given what I know of the language I suspect the main criticisms I have of it must be still valid.

    Use cases where you need that insane low level of power and control while retaining a high level language syntax are not common at all.

    Can anyone give an example of where C++ really shines these days over other languages?

    1. Re:Why use it? by Anonymous Coward · · Score: 0

      Can anyone give an example of where C++ really shines these days over other languages?

      Making apps with buffer overruns?

      (ducks)

    2. Re:Why use it? by Anonymous Coward · · Score: 0

      Can anyone give an example of where C++ really shines these days over other languages?

      Like most video games, major web browsers, photoshop, autocad, ... just to list a few. Go to Bjarne Stroustrup's home page for a full list.

    3. Re:Why use it? by adonoman · · Score: 1

      Resource handling. Lower-level languages require you to manually release any resource you acquire. Every piece of heap allocated memory needs to be freed. Every file you open needs to be manually closed. Every network connection, mutex, or handle needs to be released. It's feasible to do, since you don't have to worry about exceptions. But it does require an incredible fastidiousness to make sure that you always clean up after yourself.

      When you get to the higher level languages, you get garbage collection which means never having to manually release memory again. But everything else is stuck being released manually. You can't do it reliably in regular code, since exceptions get in the way, so they introduce things like finally or using. But again, you're relying on the people using the class to remember to clean up every single time they use it.

      In C++ you can rely on stack-unwinding to clean up after you. I haven't checked in a "delete" in over 10 years of C++ coding. Every C resource we use gets a wrapper class that automatically releases it when the object is destroyed. It's really the biggest thing I miss when working in other languages.

    4. Re:Why use it? by GiganticLyingMouth · · Score: 1

      I use C++ almost daily -- if you're doing any CUDA (or OpenCL) work, then you'll want to be using C++.

    5. Re:Why use it? by mattpalmer1086 · · Score: 1

      Sure, resource handling in C++ is one of the examples I do give of the sheer power and beauty of what you can do with the language. I used it extensively even back then. I also remember some of the issues I encountered in passing them around safely were a big lesson in the complexities, pitfalls (and opportunities) that lurk in the language. It was enormous fun, but I think I've probably been more effective in less demanding languages.

    6. Re:Why use it? by mattpalmer1086 · · Score: 1

      Fair enough... I'm pretty ignorant on how CUDA or OpenCL is programmed. What is it about C++ that makes it a good fit?

    7. Re:Why use it? by mattpalmer1086 · · Score: 1

      Good point. I checked out http://www.stroustrup.com/appl... and I can see they're mostly all quite demanding applications. I guess they deserve a demanding language :) But yes, fair enough. There are plenty of times getting the most out of what you have is going to be important.

      I once worked on Java code which ran on the most ludicrously limited hardware. It was like treacle. I spent a lot of time tuning that code. Logging was the worst offendor, but some poor algorithms lurked in there too. Garbage collection was quite noticeable, even after rewriting to minimise it as much as possible.

    8. Re:Why use it? by GiganticLyingMouth · · Score: 1

      In a word, C++ has the best binding support for GPGPU.

      Both CUDA and OpenCL started off as C-based API -- CUDA has since moved to C++, and is moving towards more modern, idiomatic C++, both for its host-side API and device-side code (e.g. has support for kernel templates). OpenCL is a bit behind in this respect, although it also has both C and C++ bindings. You can also use fortran, but the majority of use-cases for GPGPU work is C++, and will be for the foreseeable future.

      OpenCL and CUDA both do have other bindings (off the top of my head, .NET, java and python), but these are 2nd class support-wise.

  63. some fixes, lots of bloat by stenvar · · Score: 1

    Functionally, C++ compilers are great: type inference, templates, high efficiency, large scale compilations. C++11 fixes some problems. But the language has become hugely bloated, and the way new features are getting added is baroque. As for STL, few people seem to be using more than a small subset of it, and it's pretty much the same subset for everybody. Other things are still not getting fixed, like the use of include files.

    C++ needs a major house cleaning. The language could do what some other languages did and support "old" and "new" syntax, sharing the same backend and generating compatible code. But the current incremental modifications to the language will just doom it in the long term.

    (The "D" language actually appears to be such a "reboot" of C++, but I haven't used it enough to know whether it could really serve this function.)

  64. Re:Simple by LWATCDR · · Score: 1

    Honestly that will probably be more of an issue with the OS than using STL. Context switches suck.

    --
    See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
  65. Too much bullshit, just to set up a project. by Anonymous Coward · · Score: 0

    So have they finally fixed the name mangling issue, calling conventions, and binary compatibility with C++ libraries produced on different compilers for the same architecture? No?

    Carry on then. Nothing to see here. I'll just continue using Java and C#. If I try to link a library there, it Just Works(TM).

  66. Re:too heavy, too unreliable... at least for my us by Anonymous Coward · · Score: 0

    I haven't seen performance problems with the STL in years. I write low level mathematical solvers for CAD/CAM systems and I use the STL all the time. I never have performance issues with it.

  67. View from a Non-Programmer by BoRegardless · · Score: 1

    The view I get (from one who stopped at Fortran) is that there is an incredible amount of variety in how programmers look at a "language."

    Divergent opinions from experienced programmers gives me a different view of what current programming involves.

  68. Re:Simple by Gibgezr · · Score: 1

    EA's "custom" STL implementation was mostly just a customized memory allocator.
    Game companies use STL container objects all over the place in their code; it is considered safe, efficient, and familiar.

  69. needs managed execution as an option by Anonymous Coward · · Score: 0

    Most modern languages offer managed execution, while C++ doesn't. Sure, everyone can name a few situations where unmanaged code is still needed, but the 98% case in modern times is for managed code. In fact, many programming shops won't allow the use of unmanaged languages to develop customer-facing apps any longer, due to the risks it entails.

    C++ needs this as an option unless it wants to become increasingly irrelevant to modern programming. Already they just teach Java or C# in many CS departments now, not C or C++.

    Change with the times, or go the way of the buggy whip industry.

    1. Re:needs managed execution as an option by Anonymous Coward · · Score: 0

      Spoken like a typical, young script kiddie lacking a valid opinion on what good programming really is. Your entire comment shows you know absolutely nothing about C++.

      "Managed code" is paint-by-number. It's for morons too stupid to actually write good software. Thanks for all the bloated, buggy crap. If C++ is a buggy, then Java and C# are pogo sticks.

    2. Re:needs managed execution as an option by Anonymous Coward · · Score: 0

      Except that by this point it is clear from history: programmers do NOT write good software, and they DO have buffer overruns and other bugs. Even in critical code.

      Use the right tool for the job. In the vast majority of the cases, that isn't going to be such a low level language as something C based.

  70. C++ by Anonymous Coward · · Score: 0

    No, I use MSVC++ .NET express. I don't think Microsoft Visual C++ comes with the Standard Template Library, but I might be wrong.

    1. Re:C++ by Anonymous Coward · · Score: 0

      Yes, you're wrong.

    2. Re:C++ by Anonymous Coward · · Score: 0

      What a moron.

  71. C++ is still the best when optimization is needed by Anonymous Coward · · Score: 0

    I write image analysis software that has to interface with cameras and other devices through USB, Firewire, Ethernet, and serial connections, and which processes 4 GB of images per minute, using a variety of filters and segmentation algorithms running in different threads to make different measurements in parallel. Getting the code to run fast enough was mostly a matter of clever algorithms, but SSE vectorization (some done manually, some done automatically by g++) is also necessary. And, because I'm doing my own memory management instead of using garbage collection, the program only needs a couple hundred MB of memory, total, to handle that stream of 4 GB per minute. It was also helpful that well-tested C libraries for all those communications interfaces were available for free. So, in terms of C++ vs. something like Java, C++ is still the best option in my particular field.

    As for C++11, it's only been in the past year or so that g++ fully supported it, so I haven't begun using it at work (although I do use it for hobby projects at home). Some features like nullptr, emplace_back(), range-based for, "override" and "final," and the "= default" and "= delete" syntax are very useful and will help people write less buggy code. Some other features, like being able to correctly parse "vector<vector<int>>" without a space between the closing angle brackets, are way overdue, as are some minor things like supporting a string object instead of a char * as an input to ifstream::open().

    Other features, like lambdas, delegating constructors, and some of the klunky new libraries, I'm not sold on, yet. And for most situations, "auto" seems like a very bad idea; it makes code easier to write but harder to understand. And the new "->" function definition syntax, although I understand why some situations require it, feels rather ugly to me.

  72. Re:Simple by Herder+Of+Code · · Score: 1

    That's funny, I was reflecting on my days working with EASTL too. But yeah, it's all about memory allocation. People don't realize how incredibly tight memory was on a Wii/PS3/Xbox 360.

  73. I'm ok w/C++ and STL. by kfractal · · Score: 0

    I can get things done with it which were a complete pain before STL started to work w/o too much thought.

    I don't write Perl scripts any longer. But, I never really try to use things like exception handling, inheritance, multiple or otherwise (unless seriously shallow), non-trivial const correctness, operator overloading, etc. There are weeds in there you're not likely to recover from brushing against.

    Long story short: now great for simple, "get it done" jobs which were sending me to scripts before. If I were writing a modern library (e.g. Qt or the like) I'd stay way away from it.

     

  74. Re:Simple by serviscope_minor · · Score: 2

    The library size for one.

    Most of the STL is in headers. If that's causing problems with library bloat, you need to find a better vendor. Specifically what is too heavy? I doubt using std::push_heap on a statically allocated array would be smaller than if you wrote some heap code yourself.

    I do not see why anyone is getting upset over my comment.

    We're not upset, just skeptical. The reason being is that the arduino environment runs C++ happily, and you can pick and choose things out of the STL effectively. There's plenty in there that will run on raw arrays, and I'd be surprised if it generated more code than a by-hand implentation.

    --
    SJW n. One who posts facts.
  75. In context, STL also refers to that by tepples · · Score: 1

    I think "STL" here refers to those parts of the C++ standard library descended from STL. These tend to have a better reputation than, say, the pile of unidiomatic bloat that is .

  76. Re:Simple by Herder+Of+Code · · Score: 1

    I've worked with a lot of embedded system where memory was under 64MB and that was recent stuff. You have custom allocators for everything so that you can track with tools where every single MB went. For us the STL usually gets wrapped or replaced to prevent non system engineers from doing really stupid crap with it ( the things I've seen...) we need to account for all that memory. Mostly changes were things like fixed size vectors.

    Anyways, look at iOS dev for an ARM SoC. Still today, developping an app that uses over a 100MB of RAM is pretty iffy. You'll get low memory warnings on plenty of iOS devices. I usually had to develop with managed languages and I really, really missed the ability of having custom allocators to track every single byte. It just makes memory profiling incredibly time consuming and imprecise IMHO with most of those languages. Some of those did have really good memory tracking tools but it wasn't ported to the iOS version, others just plain don't have detailed memory allocation tracking.

  77. Re:Simple by serviscope_minor · · Score: 1

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

    Except you don't since G++ supports the AVR stuff just fine. In fact the arduino environment is C++.

    --
    SJW n. One who posts facts.
  78. Re:Simple by Anonymous Coward · · Score: 0

    C99 does NOT have references.

  79. Watch This by Anonymous Coward · · Score: 0

    A *lot* of these comments reflect dated impressions of C++. Try this, which gives a great overview of what C++ can be when you're using idioms from C++11 (and it previews some of C++14).

    http://channel9.msdn.com/Events/Build/2014/2-661

  80. Code sharing by tepples · · Score: 1

    Another big use for JNI that I can see is reusing existing application logic written in C or in C++ on a platform that prefers that front-ends be written in Java. Android is a well-known example here.

  81. Re: Simple by Anonymous Coward · · Score: 0

    There are no references in c99. It is filled with lots of other useful stuff though.

    Primarily, you get bools, vlas, variadic macros, restricted pointers, designated initializers, complex numbers, ability to declare variable where they are used instead of the function header and the ability to bind array lengths to array arguments to a function.

  82. Re:Simple by Rei · · Score: 1

    First rule of optimization: Don't.
    Second rule of optimization (pros only!): Don't yet.

    The thing about STL is that it's generally quite fast on its own, and if you ever need more speed doing a particular operation, you can just extend it to access its underlying datastructures. As a general rule, though, the only way you're going to get better performance is doing operations that are "dangerous in general". Which may be fine in your specific case, because you may know enough about your data to know that you don't need, for example, bounds checks or whatnot. But it should only be done where there's a known need for it.

    It should also be noted that STL algorithms are generally pretty optimized, and that a lot of programmers aren't really all that good at optimization on their own, so it can actually increase performance sometimes. Example: if I grep in the g++ headers I see __restrict__ used 65 times. How many programmers do you know that make regular use of __restrict__ where they really should? I'd bet it's in the 10% ballpark. But it has a huge impact on array performance in many circumstances.

    It should further be pointed out that a lot of the evolution of the language is focused on making there be no penalty from using containers vs. rolling your own implementation with pointers. For example, move constructors.

    Lastly, the obvious: STL code Just Works(TM). Rolling your own is a great way to introduce unexpected bugs. Doubly so if you rely on a raw pointer-based implementation.

    --
    When was the last time you ran anywhere? I mean with your own legs, not by pressing 'X'?
  83. Re:Simple by LWATCDR · · Score: 1

    I can tell you that the ARM programmers are really tight for space and wish they could use STL but it is just too big. I am maintaining an MFC Windows codes base so they did not use STL. Maybe I should have just said that STL is great and you should use it if you have the resources. I do think STL is great but again if you do not have the resources you can not use it.

    --
    See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
  84. Re:Simple by tepples · · Score: 2

    Case in point: I compiled hello world using for a Game Boy Advance. After I added -Wl,-gc-sections to remove unreachable code, it still took 180,032 bytes out of the system's 262,144 byte main RAM. Much of this space was dedicated to libstdc++ bringing in the libraries for "locale" (date, time, and money) support, even if a "locale" sensitive object never gets printed.

  85. Funny by Anonymous Coward · · Score: 0

    I love reading the comments by sub-par programmers whining about C++. Stick to your toy languages (Java, C#, Ruby, Python, etl al.), and you'll be OK.

  86. Re:C++ admits it is too complex with "auto" for ty by Anonymous Coward · · Score: 0

    No need to "trust" the compiler. The compiler is at all times 100% aware and sure which type a certain expression will yield. And since it knows anyway its often convenient to ask it to supply the correct type. So its more "Dont make my me type so much" than "I have no idea what to put here". But surely some people will use it that way as well. It also could save you a lot of time when you choose to change containers for example.

  87. Very specific point answer by fnj · · Score: 1

    C++11 is really the first reasonable version that you don't have to fight with to do anything.

    Until C++11, all we had for smart pointers was the abomination of auto_ptr, with its completely screwed up design. It's a miracle if you could code correctly using auto_ptr until you gained long experience with its pitfalls. Yet I don't even regard C++ code written without smart pointers to be acceptable, and it certainly misses the whole point of C++. I would fire coders using naked pointers. OK, after boost showed up and got reasonably mature, you could fight with corporate to get permission to use it in order to get shared_ptr. Or you could try to roll your own, and reproduce all the development mistakes yourself.

    C++11's shared_ptr and unique_ptr make all the difference.

    Other than that, we FINALLY have nullptr rather than the abomination of using literal 0, or a macro which amounts to the same thing, to represent null pointers. We can finally overload functions on int and pointers.

    Move-semantics and rvalue references are a big efficiency breakthrough, too. As is uniform brace init, which fixes the classical stab in the eye where a temp which was a default class init was interpreted as an invocation of a function taking no arguments instead.

    class C { ... };
    C x = C(); // properly default-constructs a C
    x = F(C()); // interpreted as a call to a function C, fed to the function F

    Now you can just do x = F(C{});

    1. Re:Very specific point answer by EMG+at+MU · · Score: 2

      I would fire coders using naked pointers.

      I think this really reflects the flexibility of C++. You can write bare metal code and you can write high level application code ini the same language. There are so many situations where naked pointers are superior to smart pointers and the other way around, and if you get the two camps in the same room there is a good chance they will kill each other trying to convince the other side that their way is the one true way.

    2. Re:Very specific point answer by Megane · · Score: 1

      Yet I don't even regard C++ code written without smart pointers to be acceptable, and it certainly misses the whole point of C++.

      I thought the whole point of C++ was to add functions to structs to allow object-oriented programming. Or at least that's the idea I got when I read D&E.

      --
      #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    3. Re:Very specific point answer by david_thornley · · Score: 2

      Alternately, you use shared_ptr to express shared ownership, unique_ptr to express sole ownership, and raw pointers to express that the pointer doesn't own the memory in any way. That can work.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  88. What makes a language good? by darkwing_bmf · · Score: 1

    What makes a language good? I'd argue that most will let you do what you want. And you may be proficient in any given language. But what makes one language better than another is the following.

    When you are given someone else's unintentionally screwed up code, is the language easy to understand so that you can find the bug(s) in a reasonable amount of time? Does the language disallow questionable code so that the other guy is less likely to screw up in the first place?

    I'm fairly certain that if I'm the only person working on a project C++ would be great. Not my first choice but not bad by any stretch. But if I have to debug someone else's code, C++ would not be fun.

  89. Re:C++ admits it is too complex with "auto" for ty by Rob+Riggs · · Score: 2

    "auto" is there to reduce the typing -- that is all. Instead of writing MyContainer::const_iterator::value_type x = ... I can write auto x = ... because the compiler can deduce the correct type. It is not "too complex".

    It is a convenience, like a "for loop" with a built-in iterator is there because requiring the programmer to write the boiler-plate required for a "for loop" with "do/while" is stupid. Your headline might as well read "C admits it is too complex with for() loop construct."

    And C# is not collapsing under its own weight. Any programmer, no matter what language they program in, that is not using a modern, intelligent IDE is wasting time and money -- they are a hack (in the worst sense of the word) and not a professional.

    --
    the growth in cynicism and rebellion has not been without cause
  90. STL is very good. Used in heavy duty computation by 140Mandak262Jamuna · · Score: 1
    I develop very complex meshing codes using C++ and STL. It works very well. So far I have had just two issues.

    The STL performance spec for size() function for std::list is undefined. Gnu and Linux want to keep std::list::splice() constant time and so they have made size() order N. Microsoft has decided to keep size() constant time and has made splice() O(N). I don't use splice, so I was adversely affected on Linux. But worked around it by creating a counted list class.

    I think sometime back STL changed the spec seriously in a non backward compatible way. Something to do with std::set/map/multiset/multimap::iterators. They made the iterators returned by find(), upper_bound() and lower_bound() const_iterators by default. (Or something similar). All prior code that was using iterators had to adjust. Most of my fellow coders used const_cast() and got around it. I never use const_cast(), so I had to do some significant refactoring, rearchitecting, reimplementation.

    But for these two issues, STL is working very well for heavy duty computation in finite elements, CFD, computational geometry and such fields. Scales very well. I have had maps and multimaps running into tens of millions of members and then I do insane amount of insert() s and erase()s. Works well. If you give weight to the amount of CPU these codes chew up, we form a significant market share. On unweighted plain numbers, we are probably dwarfed by the number of web applications, ruby people and java hackers.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  91. C++ vs. Java and Python. by Esben · · Score: 1
    My experience:

    When I started at my current job 7 years ago I came from C and C++ to Java. I liked Java a lot. We had a little bit of C++ and C utilities but our main application was Java.

    Then we needed something running realtime and I went back into C++. It took quite a while to make a relative simple application because I had to start from scratch with basic network and serial interface handling. Also I had to make an interface protocol to speak with the rest of the application writen in Java.

    Then we started another much larger add on which needed high performance. C++ was the only realistic choice. I estimated the time to write the code would be 3 times that of our prototype written in Python. I was wrong! It is hard to meassure because the prototype and the production code did not do the same thing, but it certainly did not take 3 times the efford to write it in C++ than Python. And compared to Java it was not much harder to write it in C++. Debugging might be a be harder, but we have no problems with memory leaks, segmentaion faults and other memory issues being the usual problems haunting C++. And note: Java and Python also have memory leaks due to dangling references. These can be very hard to find, too.

    C++ is not 3 slower to write code in than Java and Python as I expected. It is almost 1-1 - as soon as you have written the framework of your application. One of the major design rules which definitely helped us was: Avoid multithreading ! Instead our application is split in processes, communicating with sockets. Each process is a loop around a select() call. The split in processes makes it much easier to spot errors. Each process is run in a while loop in a screen such the system can recover from a crash of one of the processes.

    We avoid memory leaks by using (now deprecated, I know) std::auto_ptr. It is implicit in our code that the owner have the auto_ptr, while all others jave a plain poitner to the object. The owner have it as a auto_ptr. shared_ptr are rarely needed.

    Another thing: We write Java like rather than C like C++: We do not use pointer arithmetic. We use STL or our own containers. We avoid unsafe typecasting. We try to code against interfaces rather than implentations and all the other best practises of object orientated programming. Stuff you only learn properly by coding Java or another OO language.

    The network handling in the C++ parts worked almost flawlessly, old bugs keeped appearing in the Java network code. This was because Java per default rely on thread for everything: Befoe select was added to Java you needed a thread for reading a thread for writing for each TCP connection. And getting the threads to work together quite right is hard - in any language. Then it is easier to have one thread and events when the socket changes state.

    The major issue with C++ over Java and Python: "Batteries are not included". And no STL is no near the standeard libraries in Java and Python. Not even boost gets close. But in our case, once we had the basic eventdriven framework with sockets and buffers, connection handling build up of logical classes around a select loop it was easy to add new functionality. C++ is not good for writing large monolithic applications because it can be very hard to localize errors - Java handles that much better because it is much easier to localize errors. But Java (and Python) still uses way to much memory when you represent data as objects.

    Another thing C++ has is ofcourse templates. It is a really good alternative to object orientated techniques for writing re-useable, generic code. The good thing is it all bindings happens compile time. That means both that many errors are caught compile time, and that the compiler can optimize seemingly very expensive code. When calling a virtual function in an interface the compiler very rarely can figure out which implementation it really is and do optimizations.

    All in all: C++ is a good, powerfull and high performance language - but it requires a lot of de

  92. Re:Simple by serviscope_minor · · Score: 1

    I can tell you that the ARM programmers are really tight for space and wish they could use STL but it is just too big.

    I'm still curious how: I've not programmed on small ARMs, but I have used AVRs. They're not exactly generous for space. You keep saying it's big and takes up resources, but I'm curious how.

    Take the following rather silly code which implements a global pqueue of ints. Sort of what some embedded code might look like:

    #include <algorithm>
     
    int heap[1024];
    int size=0;
     
    void add_to_global_pqueue(int n)
    {
        size++;
        heap[size] = n;
        std::push_heap(heap, heap+size);
    }
     
    int pop_from_global_pqueue()
    {
        std::pop_heap(heap, heap+size);
        size--;
        return heap[size+1];
    }

    How much bigger is that code in the resulting ASM than writing a heap by hand? I had a look at the ASM code in gcc, and to me it seems pretty tight. Likewise with functions like min_element, and so on.

    Sure if you pull in stringstream for de/derialising things then that's big. I doubt anything in algorithm, numeric, functional and so on would be substantially larger than hand-coded versions of the same.

    --
    SJW n. One who posts facts.
  93. Re:Standard Library is both a strength and weaknes by Carewolf · · Score: 1

    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.

    That is why you use Qt.

  94. This is a remarkably civilized thread by VTBlue · · Score: 1

    In all my years of using slashdot I can't recall a thread where I learned more from others just by reading comments. Very good stuff here!

  95. Re:STL is very good. Used in heavy duty computatio by serviscope_minor · · Score: 2

    Good news for you: size() is now O(1) in C++11.

    --
    SJW n. One who posts facts.
  96. I seriously prefer C by Rob+Y. · · Score: 1

    Where I work we build apps in C on top of a home-grown platform. Various project managers have let developers use C++ when they wanted to, and without fail, the C++ code is much harder to support than C code. Part of it has to do with the C-based library and its persistence model, which isn't very C++-friendly, so the C++ stuff tends to build its own concept of what an object is in this context, and it invariably adds layers of complexity to what is a pretty nice and conceptually very simple C-based app platform. It also doesn't help that the dbx debugger on the AIX platform we run doesn't handle C++ objects nicely. Essentially, it's really hard to know what C++ code in this environment is doing. And without a powerful C++ framework to take advantage of the language, the language itself is more trouble than its worth.

    I've done some work in Java, and was pleasantly surprised. To me, it turns out that the nice thing about Java isn't its object orientation. It's that it doesn't count on the compiler having to know the internal structure of class objects. No .hpp files, no need to define everything twice. And garbage collection (if it really works...). I still prefer C - since I have a good sense with it of exactly what is happening at any point in my app. But when I have to use it, Java's not bad. C++ still gives me a headache.

    --
    Posted from my Android phone. Oh, I can change this? There, that's better...
    1. Re:I seriously prefer C by david_thornley · · Score: 1

      Various project managers have let developers use C++ when they wanted to, and without fail, the C++ code is much harder to support than C code.

      Bad idea. C is a pretty good language, and so is C++. Know which one you intend to use, and which features you intend to use (if a subset is applicable; some C++ features apply very nicely to embedded systems, and others, like exceptions, don't).

      You can use C++ as a "better C" rather than as its own language, but you need to make that a conscious decision.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  97. Re:Simple by Megane · · Score: 1

    Not all "Embedded ARM SoCs" are monsters that run Linux. They also include Cortex M, which usually comes with no more than 64K-96K of RAM and 512K-1M of flash on the high-end M3/M4 models. On those you generally want to avoid the kind of programming that throws around calls to malloc/new like they were junk mail.

    --
    #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
  98. Re:Simple by Megane · · Score: 1

    Not to mention the minor detail of lacking any sort of tty console hardware to use those iostreams on.

    --
    #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
  99. Re:Simple by tepples · · Score: 1
  100. Re:Standard Library is both a strength and weaknes by gbjbaanb · · Score: 1

    not really - what you need is to pick a few libraries and pull them in. Unlike other languages where you use what comes with your IDE, with C/C++ you are encouraged to find and use reusable libraries.

    So if you want XML, get tinyXML and use that. If you want http - boost::asio or curl. Web Services (REST or SOAP?) gsoap or boost::asio or civetweb/mongoose, and so on.

    This is a huge advantage. If I want an embedded webserver in my code then I'll include civetweb in it and with 4 lines of code and 2 c files, I have my code answering http requests. It will be limited in functionality, but that's ok as my embedded server only has 40k added to it by doing this. If I want something much more featured, I'll use a different server library.

    If I want JSON, I'll go grab a JSON library, good luck using JSON in your that didn't see fit to include a parser for it. I would like to see boost wrappers/reimplementations of many common libraries like XML or SQL, but ... maybe one day I'll have a go at contributing one.

    The only disadvantage to this is finding which library is the most suitable for you.

    PS. async in cpp?

  101. Re:Standard Library is both a strength and weaknes by Megane · · Score: 1

    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.

    But don't worry, that'll get fixed Tuesday in the monthly update to all major versions of the libraries! Even those lowly .NET 1.0 programmers will get the updates!

    --
    #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
  102. Re:C++ admits it is too complex with "auto" for ty by mbkennel · · Score: 1

    | By introducing "auto" for types, C++ has admitted that it is too complex for human beings to understand.

    No, it's admitting that working with libraries and systems without 'auto' require mental effort by humans that shouldn't be necessary to exert.

    | The "auto" type declaration means that only the compiler can figure out what to put for a new type. By using it, the programmer is saying "I have no idea what to put here, so I implicitly trust the compiler to do it for me."

    Indeed, and there's nothing wrong with that.

    Like f(g(something))

    The compiler figured out that the static type constraint of the return value of g() is compatible with the argument of f(). Why is that OK (which has been fine since neolithic ages), but

    auto z = g(something)
    f(z)

    not OK?

    Simple type inference is decades overdue, and it reflects an actual intent of the programmer: "declare a variable which can hold the return type of some function". The point being that with development, if that function's return type changes (or is implicit through complex templtatizations), with C++11 type inference (auto and decltype), the program continues to compile and work cleanly. Without 'auto' and 'decltype' used appropriately the programmer can't express his actual intent.

    I use C++11 now and think it's a good improvement. BTW, the Eigen matrix library for C++ is fantastic. I'm a computational programmer at times and I've waited many years for something this good and easy.

  103. Computational code by mbkennel · · Score: 1

    I felt your pain, but the practical state of C++ is much better today.

    A great application which I use is computational code with modern C++ template libraries for the problem domain. Fortran 2003 is also highly competitive (and in some cases superior) here.

    What is "Big Data" analytics? Computations at the limit of capacity. Constant factors really do matter---more efficient computations in space and time mean you can ingest more data and that gives better models. Markov Chain Monte Carlo and other stochastically iterative/converging machine learning algorithms are not trivially parallelizable, and doing so induces a very large overhead in programming complexity.

    1. Re:Computational code by mattpalmer1086 · · Score: 1

      Yes, I can see that sort of code would benefit a lot. Not an area I've done much work in, but I guess a lot of people are. I'm actually really interested in code that performs well - I spend quite a lot of time profiling and tuning. Some of the things Martin Thomson has done in Java land are pretty cool. Check out http://lmax-exchange.github.io... and http://mechanical-sympathy.blo...

  104. Re:too heavy, too unreliable... at least for my us by Anonymous Coward · · Score: 0

    Then you're just a bad programmer. I write real-time embedded systems with C++ and the STL. STL blows the doors off your roll-your-own crap. Good old efficient, manageable and predictable C++ (hey, if you can write sentence fragments, so can I). STL *is* great for many people (people that actually know how to write software).

  105. C++11 by Meneth · · Score: 1

    I've used C++ since 1997.

    Don't care much for the STL. Its syntax is nice, and I don't mind the size overhead much, but the compilation time is noticeably increased the more templates you use.

    C++11 has a bunch of syntax improvements, like "auto" and inline class member initialization. I think I'll use it for most of my future programs.

    1. Re:C++11 by Esben · · Score: 1

      If you do not use templates and STL, what is the point of C++? You can do the same in C, you just have to make the v-table by hand as is done in the Linux kernel.

    2. Re:C++11 by shutdown+-p+now · · Score: 1

      You still get things like RAII from the language itself.

  106. still bad, getting worse with time by Anonymous Coward · · Score: 0

    still bad, getting worse with time.

    Features are added and behavior is changed for the sake of changing, with no benefits to any software quality whatsoever.
    C89 is still the only language which makes sort of sense to use for low-level programming (with most of the c99 and later standards adding nothing of real value). For higher level programming, there are much better languages to use.
    A niche for a _subset_ of C++ is in graphics and games programming, since those applications really profit from the balance of performance and object-orientation of the language.
    I have to use C++ in its latest incarnations on the job every single day, and it's just terrible.
    Thanks for asking and for a nice opportunity to vent in frustration.

    1. Re:still bad, getting worse with time by GiganticLyingMouth · · Score: 1

      Features are added and behavior is changed for the sake of changing, with no benefits to any software quality whatsoever.

      Spoken like someone who doesn't know what they're talking about.

      No benefits to software quality? Point out any new feature in C++11 that was added that didn't have a reason. (I would be very interested in fact, as I can't think of any off-hand); the newly added features are done with specific problems in mind. They might not be the problems that YOU encounter, but someone else has.

    2. Re:still bad, getting worse with time by Anonymous Coward · · Score: 0

      > Point out any new feature in C++11 that was added that didn't have a reason.
      User-defined string literals.

      In terms of the problems we have to face, it's pretty much no fucking where.

  107. Re:C++ admits it is too complex with "auto" for ty by Anonymous Coward · · Score: 0

    "auto" is there to reduce the typing -- that is all. Instead of writing MyContainer::const_iterator::value_type x = ... I can write auto x = ... because the compiler can deduce the correct type. It is not "too complex".

    plus the "advantage" of not having any idea about what that type might be by just looking at that fragment of code if the variable is assigned a result from a function call for example.
    And the "feature" of having a good fun run through the code to find out what that type is.

    But of course all of that is fast and easy because we professionals all use...

    It is a convenience, like a "for loop" with a built-in iterator is there because requiring the programmer to write the boiler-plate required for a "for loop" with "do/while" is stupid. Your headline might as well read "C admits it is too complex with for() loop construct."

    And C# is not collapsing under its own weight. Any programmer, no matter what language they program in, that is not using a modern, intelligent IDE is wasting time and money -- they are a hack (in the worst sense of the word) and not a professional.

    an IDE! Yes of course, who wouldn't?
    And of course C# is equal to C++.

    Bravo for the top trolling.

  108. STL is painful to use by SoftwareArtist · · Score: 1

    Speaking just about STL, I'd have to say it's one of the worst designed container APIs I've worked with. It just goes out of its way to make your code painful to write and hard to read.

    Suppose you want to determine if a collection c contains an element e. In any other language, you'd write something like c.contains(e). But the STL designers, in their infinite wisdom, decided instead you should write c.find(e) != c.end(). Because that's just so much more readable. Suppose you want to determine if a string s ends with some suffix t. In any other language you would write something like s.endswith(t). But in C++ you write s.rfind(t) == s.size()-t.size(). I think? I'm not 100% sure I didn't make a mistake in there.

    C++11 tried to fix some of the worst aspects of STL, but they didn't redesign it from scratch, which is what it really needs.

    --
    "I'm too busy to research this and form an educated opinion, but I do have time to tell everyone my uninformed opinion."
    1. Re:STL is painful to use by Mr+Z · · Score: 1

      Suppose you want to determine if a collection c contains an element e. In any other language, you'd write something like c.contains(e).

      I have good news for you! Sure, you still need to provide begin() and end() to specify a range, but it's a step forward. And, with the new non-member begin() and end() you can even use it on plain arrays.

      Yeah, you still have to put all the pieces together yourself, but the pieces are a bit more uniform now and there's usually fewer to worry about. (Especially now with auto.)

    2. Re:STL is painful to use by SoftwareArtist · · Score: 1

      Are you suggesting I should instead write something like any_of(c.begin(), c.end(), [&e](int i){return i==e;})? (I'm not sure if I got the syntax exactly right. I haven't used lambdas yet.) That's even worse to type, harder to read, and more likely to contain errors.

      --
      "I'm too busy to research this and form an educated opinion, but I do have time to tell everyone my uninformed opinion."
    3. Re:STL is painful to use by Mr+Z · · Score: 1

      Yeah, the fact that it takes a UnaryPredicate does pretty much mean you need to use a lambda or a functor. I also meant my comment half ironically. It is a step forward, but you still have shit on your shoe.

  109. Not just dated.. by Anonymous Coward · · Score: 0

    Agree. When I complained about C++ complexity to a friend of mine, who knows Bjarne Stroustrup personally, he said "Bjarne did not do it deliberately. He is a nice guy."
    Just today, when another friend of mine mentioned he wanted his son to learn a bit of programming by starting with C++, I told him that is the surest way to turn him off coding forever.

    1. Re:Not just dated.. by davecb · · Score: 1

      Being nice doesn't make you wise. Mr. Stroustrup is certainly intelligent: I've read his apologia*, and have no doubt he was following a good lead, and wasn't planning to fail.

      --dave
      [* See https://en.wikipedia.org/wiki/.... I'm using it in the religious sense]

      --
      davecb@spamcop.net
  110. It's great, but we try not to use it. by Sarusa · · Score: 1

    Compared to what it used to be, C++11 is very nice. But it's still one of the ugliest, most obfuscated languages for general production work. I realize why this is so - speed and memory concerns still make it the go to language (har) when you really care about either of those.

    I used to use C++ constantly. But it's very rare now that we can't just write what we need in C# (medium to large scale) or Python (small to medium scale) in 1/3rd the time (or 1/10th for anything GUI). And for embedded we're still using pure C.

    So we use C++ in that very rare intersection where we have some complexity and speed actually matters. Most recently in an image pipeline where the app itself is all C# and the heavy lifting (billions of pixels) is done in non-managed C++ (they didn't want to require GPU). It was okay, but using C++ and C# together makes you really aware of just how much administrative overhead C++ has, though the classes certainly made things better compared to pure C.

    So... it definitely has a niche, but it's not normally the most efficient way to do things, for implementation speed, cleanliness, or maintainability.

    1. Re:It's great, but we try not to use it. by Mr+Z · · Score: 1

      I actually use C++ for embedded programming, because when used with care, it can actually do a better job than C for a number of things. I use template meta-programming to compute various things at compile time, such as, say, register initialization values and what not. Sure, I can do the same with #define and a boat load of macros, but that has its own issues. Not only are macros messy in their own way, they don't provide a good way to sanity check your settings. With templates and types done right, I can actually get the compiler to sanity check my settings at compile time. I don't know how many times I've chased down a bug due to swapped macro parameters that could have been caught compile-time with some type checking / trait checking.

      I've written an entire C++ based support library just for this purpose. One of its goals is extreme compactness and cycle efficiency, since the code often needs to run in RTL simulation. Software RTL simulation of a large SoC runs in the 10s to 1000s of cycles per second, so cycle efficiency is at an extreme premium.

      What my library largely replaces is other C and assembly code that (often hamfistedly) computes everything at run time, and so my code can handily beat that.

      I haven't quite hit the nirvana of generating an entire MMU page tree from a compact memory map description using templates (I have a perl script for that), but it sure beats 100,000s cycles or more computing it at run time when that translates to hours of sim time. (Fun fact: Some rather popular modern processors run really slow until you turn the MMU on, because they can't cache any data until you do.)

      I have however written dynamic code generators that use templates and function overloading to resolve as much of the opcode encoding as possible at compile time, so that the run-time portion usually is just a "store constant" or maybe a quick field insert into a constant followed by a store. Those can pump opcodes to memory as fast as an opcode per cycle (and in some special cases, faster), which is pretty darn good. Again, all typechecked as much as possible at compile time, to minimize or eliminate the possibility I generate invalid instructions.

  111. Re:Standard Library is both a strength and weaknes by Anonymous Coward · · Score: 0

    > Things like HTTP, XML, web services, SQL, configuration, and cryptography should be built in

    I couldn't disagree more.

    C++'s standard library follows the same general philosophy as C's. The standard library is for features which earlier languages typically made part of the language, but don't actually need to be part of the language.

    E.g. Fortran, Cobol, and Basic all provided I/O statements (WRITE, DISPLAY, PRINT), with their own keywords and syntax. C provided library functions, declared in stdio.h.

    High-level languages have to throw everything (up to and including the kitchen sink) into the standard library, because you can't just use any old third-party DLL/DSO directly from within the language; someone has to write a shipload of interfacing code (JNI or whatever) first.

    The problem with trying to standardise high-level functionality such as HTTP is that the interface either has to accept a thousand parameters to control all of the myriad details, or it has to make a thousand choices for you (and many of those will be the wrong choice for some non-trivial proportion of its target audience).

  112. Re:Standard Library is both a strength and weaknes by PhrostyMcByte · · Score: 1

    Unlike other languages where you use what comes with your IDE, with C/C++ you are encouraged to find and use reusable libraries.

    Encouraged is a funny word, seeing as there's no other choice... but that's beside the point.

    Having to dig out multiple libraries to make any non-trivial project is a pain. Having to worry about TinyXML's lack of standards compliance and proneness to buffer overruns (in an older version at least, not sure if it's still there), gsoap's godawful API, wrapping libpng's setjmp/longjmp error handling in exceptions, wrapping libcurl with RAII objects, or XYZ's exception safety, etc.

    There's something nice to be said about having a very cohesive set of libraries by default. Same level of quality, same familiar style, same level of documentation, same integration with the rest of the library and language. C++ getting these things would not force you to use them, it would simply let devs bootstrap their apps a lot quicker, and far more robustly.

  113. header files by StripedCow · · Score: 1

    But still they didn't remove the need for those pesky header files. Aaaahrrghgh

    I'm really done with typing every function declaration twice!

    --
    If Pandora's box is destined to be opened, *I* want to be the one to open it.
  114. Use scala by Anonymous Coward · · Score: 0

    I have done a lot of
    Java, some what significant C++ and a lot of other languages. Scala is the way to go. C/C++ only for compute intensive and/or High Performance Computing. Everything else that is more complex and not compute intensive you are better off with Scala (compatible with Java and yet much more elegant and concise).

  115. High cognitive load by jgotts · · Score: 1

    The best programming languages work like and use the same parts of the brain that reading and writing do. It is no surprise that the language of mathematics reads left to right, uses Latin symbols, and roughly follows European languages in grammar and syntax. (In certain parts of the Arab-speaking world, some mathematical expressions are written left to right, but this is not universal.)

    As the syntaxes of programming languages become more elaborate, the cognitive load involved in programming increases. As other parts of the brain become involved, programming error rates increase, not to mention the common sense notion that completely learning the language becomes unachievable for most people and every programmer works with his or her own subset making code maintenance difficult.

    C++ with its feature-packed templates makes people who love a language to have every concept from computer science packed into it happy, but it doesn't serve programmers and hence humanity very well.

    The ideal programming interface is you telling the computer exactly what you want it to do in English, not the the opposite. We're decades away from an AI that can automatically write code, but making the programmer's link to the computer more difficult to convey unambiguous instructions seems to be going in the opposite direction.

  116. hating comedy films because they are not dramas by Anonymous Coward · · Score: 0

    Many of you consider C++ to be an abomination.

    Perhaps this list might change your oppinion a bit:
    http://www.stroustrup.com/applications.html

    C++ is the way it is by *design*. It is ment to solve really well a *subset* of problems, not all problems. Some of the critics here remind me of people who go watch a comedy in cinema, and afterwards criticise it for not being a drama.

  117. screw you im still using ada by Anonymous Coward · · Score: 0

    screw you im still using ada

  118. Re:STL is very good. Used in heavy duty computatio by 140Mandak262Jamuna · · Score: 1

    Thanks, But I am not reverting my hack. But in future I will be a little bit more confident in using size()

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  119. This is the right approach: good judgement by Anonymous Coward · · Score: 1

    I don't anticipate moving to C++11 in the foreseeable future, and certainly not porting code that already works, unless _maybe_ it is being completely redone. STL and Boost have some useful stuff, but good judgement is required to use either.

    I use STL containers:
    - They are less trouble for all concerned than reinventing them, and they offer some useful features, like builtin sort()
    - I never, ever use custom allocators: that is my dividing line between useful and too much trouble compared to writing my own collection, in the rare situations where they are needed.
    - I will subclass a container, rarely; I'm more likely to embed, providing I don't have to copy paste too much API.
    - I never, ever use STL algorithms, for any purpose. It's easier to just write a for loop if I need one, and I get something everyone can understand.

    I very rarely use Boost classes, and only simple ones like auto_ptr variants.
    - Boost is much more on the side of way too much trouble and risk for any benefit it provides.
    - Most classes look like programming exercises using techniques (template metaprogramming) that I would never allow in production code.
    - Boost is even worse than STL for creating code that saves a few lines but takes as long or longer to write and is unreadable, undebuggable, and unmaintainable.

    In general, if advanced templated code doesn't work or needs to be extended, I'd rather spend my time rewriting it than trying to "fix" it.

    I have to wonder if anyone would bother creating C++(latest) if they didn't get tenure/job security/prestige from being on a Committee. More advanced languages already exist that have all these features; why try to bolt them on C++, where they were never intended to be? Did we learn nothing from all the abortive attempts to add garbage collection? Why not work on C++ / advanced language interop and actually make things better?

  120. Re:Simple by Darinbob · · Score: 1

    SOME embedded systems come with GBs of RAM, many of them do not. C++ can easily triple the RAM use if the developers are not mindful of what it is doing. Some styles of C++ can also screw up caching badly, as templates may reuse text code but they don't usually reuse object code. Sometimes even something trivial like using an exception drags in a ton of overhead code. Thus things like Embedded C++ which are subsets of C++ designed for smaller systems.

  121. Re:Simple by Darinbob · · Score: 1

    STL is template based. That means if you use the same template for different types then it will generate duplicated object code. Much like using a macro generates duplicate code. Templates have more type safety and rules than macros but for many compilers they are not necessarily more efficient. Sure, bigger code may not always mean it's slower but it can have a big effect on speed in a few of ways. First it means the cache is less efficient as there's more code in general. Second, two copies of the same routine means that even if the first copy is cached that it won't help you out when you call the second copy. This is not such a big deal on PCs because they have such large caches, and multiple levels of caches. Third problem is when you're on a paged system and more program space means more memory has to be swapped in and out, especially if you're context switching between multiple processes.

    Same sort of problems arise you get if you try to forcibly inline everything.

  122. Re: Simple by Darinbob · · Score: 1

    But use it well. A big problem comes with using STL blindly as a one-size-fits-all solution. These are theoretically optimal algorithms, but that does not mean optimal for ever problem, and definitely not optimal if used incorrectly. I have honestly seem rather smart people otherwise do stupid things with STL, like use std::map where the key has only 8 possible values (use a basic C array instead, or a vector if C scares you). I have even seen std::map used in a case where one and only one element was ever in the map at one time (I have no idea what they were thinking, I can only assume that the code requirements must have changed over time). I have also seen people force things into STL merely because they want to use the convenient find/sort algorithms.

    A big problem I used to see a LOT was using STL to contain the elements when it could have contained pointers to the elements. This means lots of copying, and if the elements are very large this does have a noticeable effect on performance if elements are being moved arounda lot. You don't see this as much in C as C devs tend to use pointers rather than lots of struct copies, whereas the copy contructor is ingrained deeply in C++ and used constantly. Some of this comes because C++ tries to hide the fact that copies are being done, so novices are often unaware that they're writing inefficient code.

    I have had several cases of going through and optimizing C++ code and getting very measurable performance improvements by doing only changes that could have been trivially done when the code was first written. However there's this nearly religious fear some devs have of ever optimizing code because once in the distant past they heard a professor say something vague about premature optimization and now they avoid all optimization. So their rapid prototyping style is also the style they use when performance matters.

  123. Re:Simple by Darinbob · · Score: 1

    You can use C++ on embedded systems, you just have to be mindful and not program like you were on a luxurious PC of the latest model. Instead, avoid the extra features like exceptions or STL or RTTI, or if you do use templates try to have containers of pointers to objects to avoid copying overhead.

    C++ is a great language when it is used as a better-C-than-C. Better type checking and safety, convenient auto pointers, basic classes with basic inheritance can greatly simplify a lot of code, as well as namespaces. Even virtual functions are fine.

  124. Re:Simple by Darinbob · · Score: 1

    Templated code is not good about sharing space. Or more specifically, the compilers and linkers are good about recognizing that there is essentially identical code that could be combined to save space. STL is good for code reuse in the sense of the text you write, but it is not necessarily good in reusing object code.

    Some of the C++ class libraries that existed before STL were much more efficient since they weren't heavily templated. Thus you had an actual object code library.

  125. Re:Simple by Darinbob · · Score: 1

    Third rule, ignore the people who say don't optimize. They're the reason everything is slow today, and why with a computer that's a thousand times faster than it was twenty years ago, Word does not feel any faster than it did twenty years ago. Optimization is done all the time and with good reason. Programs that put off optimization too long get a reputation amongst the customers for being slow (ie, firefox before they took time out to optimize memory usage a few years back). I have been on some projects where the customers were complaining, or where they had specific timing requirements. I have worked on projects where a major bullet point in the release notes for customers was about improved performance.

    Remember, optimization does not mean only going through existing code and finding ways to tweak it. Optimization can also mean writing it down the first time in a way that is faster than a different way. Even if you're following the religious belief to Just Use STL you can pick the right container to use, vectors are vastly faster than maps for example, chose an initial vector size rather than let it grow by chunks as you insert at the end, stuff like that.

    Too many people though code for the final production code as if they were doing rapid prototyping.

    Sure, you can say you work with a lot of bad programers so STL does a better job on average. I have also worked with a lot of bad programmers who used STL where the code was easily improved in performance by changing how they used STL. STL is a tool, and like all tools they have specific uses and are not the perfect tool for all situations, and a good tool user needs to know how the tools work and when to use them and when not to use them.

    So dammit people, optimize your code. It is easy to do and your customers will notice.

  126. Re:Standard Library is both a strength and weaknes by Darinbob · · Score: 1

    No, more things should not be built into a language. There's nothing wrong with third party libraries. Standard libraries should be short and sweet, only add stuff once they're well used and tested for a loooong time. C++ added some stuff a bit too early I think, or things that should have been left as third party addons were incorporated. A standards body is the wrong place to look if you want something well designed.

  127. Re:C++ admits it is too complex with "auto" for ty by HalWasRight · · Score: 1

    By why would you do that typing? Your IDE should be doing that typing for you. Java isn't verbose when you have Eclipse to do your typing for you.

    --
    "This mission is too important to allow you to jeopardize it." -- HAL
  128. Re:Simple by crucini · · Score: 1

    On an Atmel AVR with 2K of RAM, I found C++ works well. Of course you have to be conservative about using language features.

    I can see how with multiple programmers at different skill levels its dangerous.

    In principle with C++ you don't pay for what you don't use.

  129. Re:Simple by Mr+Z · · Score: 1

    Just for fun, I tried the same experiment on one of our DSPs, and it pulled in just over 64K. I think our library is generally leaner in the locale department. In fact, I didn't see any locale data linked in. Most of what it pulled in looks to be actual ios/istream/ostream stuff, basic_string<char> and basic_string<wchar_t>.

  130. Re:Simple by Mr+Z · · Score: 1

    It seems like writing a terminal driver is a rite of passage. :-) I did one for our DSPs, and most recently, the Intellivision.

  131. Re:Simple by tepples · · Score: 1

    Which C library is that? Is it under a free software license, or is it included only with one of those $6000 per seat (source) compiler toolchains that only professionals working for established companies in the richest countries and students and faculty at accredited postsecondary institutions can reasonably get their hands on? StoneCypher used to be a big proponent of C++ using the Green Hills compiler, but there's no way the median hobbyist developer could afford that.

  132. Re:Simple by tepples · · Score: 1

    And most recently I wrote a terminal driver for the Nintendo Entertainment System that wraps a 6502 proportional font library that I had written a few years ago. I'm using it to print the results of testing software floating-point arithmetic code in my port of Cookie Clicker to the NES.

  133. Re:Simple by brantondaveperson · · Score: 1

    STL is template based.

    Yes it is.

    That means if you use the same template for different types then it will generate duplicated object code.

    This isn't necessarily true. Well-written templates will defer to base implementations that avoid duplicated code. For instance, templated containers of pointer types should all wind up using the exact same implementation, with the type-safety only being there to keep the compiler happy. That same implementation may be usable for any trivially-copyable data of the same size.

    Templates and macros are really not even close to the same thing.

  134. Re:Simple by Mr+Z · · Score: 1

    I unfortunately claim ignorance on the license for the runtime. I know some of my employer's products use Dinkumware for the C++ library, but I'm not sure what this processor uses. (TMS320C6600 family, if you're curious.) I'm usually at the other end of the pipeline, using the pre-alpha tools before the silicon exists, so I'm pretty far removed from the customer toolchain distribution end of things. Sorry I can't be more helpful on that detail. I can tell you all about VLIW instruction scheduling and cache memory system pipeline behavior though!

  135. Re:Simple by brantondaveperson · · Score: 1

    That's completely true. But it remains the case that many of C++'s features can be used on those types of devices, and smaller ones too, and that includes templates. Though on programs of the size one tends to find on microcontrollers, there probably isn't much point. You certainly don't want to be dynamically allocating memory, but that's got nothing to do with C++ specifically anyway.

    But you're certainly never going to running Java or anything else on those things. It's Assembly, C or C++, and that's it.

  136. Re:Simple by brantondaveperson · · Score: 1

    This is something I really completely and whole-heartedly agree with.

    Related: At a conference earlier this year, a speaker made the point that since hardware speeds are not increasing at the rate they once were, it now makes more sense than ever (and it always made sense) to optimise your code.

    Of course, it sounds like the type of optimisation you're talking about is basic algorithm choices and understanding complexity. Which is CompSci 101, but does rather appear to be on the wane. I guess that's a rant for another day.

  137. Move semantics says it all by Anonymous Coward · · Score: 0

    The move semantics make me laugh every time I think of them. They introduced another potentially vexing parse in order to overcome a situation where extraneous copies of things are generated to return something from a function. How many of you were taught in programming lectures that this occurred? (Answer: None, you were too busy struggling with circular inclusions to even begin to grasp the shittiness of the underlying language).

    They didn't admit that the spec was fucked and even at the C++11 talk Bjorn rants about how performant C++ is. In fact for him now all he wants to do is play with mangling the syntax for specific purposes. He STILL is not a fucking programmer, he's just a fucking wanker.

    So they put this all through the new STL. Did they admit that all those years when they said C++ and STL was faster, that they were wrong? Did they give us an estimate of how many TRILLIONS of CPU cycles were wasted worldwide because of their failure? No, they gave themselves a pat on the fucking back.

    The only thing you can say about new C++ is that someone should have started designing a proper replacement 20 years ago. And in 20 years we will look at C++34 and the new STL and think the same thing.

  138. Re:C++ admits it is too complex with "auto" for ty by Mr+Z · · Score: 1

    Before auto it seemed like C++'s error messages were downright passive aggressive: "If you don't know what to put here, I'm not going to tell you." At least, it's not going to tell me the concise thing to put there. It will tell me the completely flattened type, which can be quite huge if you're trying to, say, get an iterator to a nested STL container holding a template class composed against some other classes (that themselves might be templated) a'la the Policy pattern.

    I just wish I didn't have to code for the lowest common denominator compiler at work, so I can be sure I can use auto with impunity. :-)

  139. Re:Simple by shutdown+-p+now · · Score: 1

    Well, you have to admit that you basically took the worst part of the C++ standard library (the one that even several guys on the Committee think should be killed with fire) for that experiment. It has exceedingly convoluted design, and does not at all follow the "you don't pay for what you don't use" philosophy that's otherwise pervasive in C++.

  140. Complexity is always there by Anonymous Coward · · Score: 0

    I used C++ for about 15 years in the video games industry and real-time engineering applications. More recently, I have been using C#, because now I mainly write Windows applications with a lot of UI. I wouldn't change either of these facts; each language is suited to what I use it for, and I am not sure I could settle on either one as my Swiss army knife.

    That said, I take the earlier point that modern languages (like C#) often seem to have a horrendous number of classes involved in everything. Virtual classes abound. and you can't find anything concrete anywhere, particularly when you start drilling into code with the debugger, and everything is a collection containing more collections.

    I'm perhaps stating the obvious, but it seems to me that complexity cannot be avoided. You either choose to express is in code (C++) or in architecture (C# and co.). Both approaches are hard. But if they weren't then everyone in the world would be able to write software, and we would all be out of a job.

  141. Re:C++ admits it is too complex with "auto" for ty by shutdown+-p+now · · Score: 1

    It may not be verbose to write, but it's still verbose to read.

  142. Re:Standard Library is both a strength and weaknes by gbjbaanb · · Score: 1

    Its true that a set of 'commonly used' libraries would be easier to handle, and maybe we'd get more contribution and documentation.

    But I'm not convinced they should be part of a standard for the language - I like something more responsive to changing needs. Boost works well for this, even if it is full of stuff I don't understand, let along have a use for :)

  143. Re:Simple by Darinbob · · Score: 1

    In the case of most STL generics, they don't default back to a base implementation if the types are slightly different (ie, long versus int). STL containers of pointers should do this, but a lot of compilers don't do this optimization (and many C++ purists will claim that containers should contain objects instead of pointers).

  144. Err, yes they are by Viol8 · · Score: 1

    When I work on other peoples code - you know, like in a "job" - then the odds are someone has used pretty much all of the features somewhere in it especially if they're some just out of uni grad who's out to impress his peers and thinks using every obscure language feature and design pattern construct he can find in even the smallest program is the way to do it.

    Sorry, but I just can't be fucking arsed with it anymore. A programming language is there to SOLVE a problem, not BECOME the problem.

  145. Use it, love it by Anonymous Coward · · Score: 0

    I've been a freelancer for 14 years now. In all that time C++ (and C for embedded) have always been my languages of choice. After all that time I've become fluent enough that the only hard part is good system design, and that is fairly language agnostic. STL makes life very easy. Using QT for developing applications makes it ridiculously quick to write user interface apps that can compile on Windows, MAC or Linux. You can get a simple app up in presentable form within a day (at a push!) and that's without using "QT designer" (QT layout containers make it very easy).

    Yes C and C++ has a steep learning curve, and yes it lets you do stupid things but that freedom also lets you do clever things. Once you know what you are doing and follow good practice, it is *easy* and becomes second nature. And no dealing with pointers is not hard. You can use selectively use smart pointers if you really want to (works especially well for apps based around asynchronous I/O, which most of mine are as I mostly deal with client/server systems).

    Regarding Java. Whenever I use a Java app it feels a bit sluggish. Just my experience; it could well be I've never used a great Java app. I feel a little "constrained" too when I write in Java, but it could just be I'm not used to it.

    Having said that, I think there is too much stock put into programming languages; they are a means to an end. A good programmer with a good design is what matters.

  146. take a look at eastl by Anonymous Coward · · Score: 0

    this paper is a little old, but many of the motivations are still sound:
    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html#Motivation

    there still quite a few game development houses which ( for similar reasons ) either roll their own versions, or completely avoid the stl altogether.

    personally, i think what matters most is: good documentation, reliability, and testability. all of which the stl is very good at.

    most of the time, when programmers are hyper-obsessed on the footprint of vector::push_back() or the speed of hash_map::find(), they seem to miss questions like: do we need to call that code at all?

  147. Re:Simple by Rei · · Score: 2

    People like you are the reason that there's so many bugs in software these days and code is so hard to maintain.

    From a less tongue-in-cheek standpoint, optimization (beyond choosing the proper data structures/algorithms and the like and thinking about where bottlenecks might occur as you go) should only be done in the following manner:

    1) Run the program and assess the need. If there is no need, STOP.
    2) Instrument the code and find out what is *actually* using up your CPU time.
    3) Improve the code in the sections that yield the most benefit; go back to #1.

    People who try to optimize everything as they go along spend most of their time "optimizing" things that have no perceptible benefit and are far more likely to simply obfuscate the code and introduce bugs. You need to assess need and find out where it matters first. Is it really worth it, for example, to optimize some string comparison that runs maybe five times in your typical program execution? NO. Is such an "optimization" a likely place to find bugs, including potentially serious ones? You betcha.

    As a side note, I find most people who obsess over optimization without profiling spend most of their time doing "optimizations" that don't help at all or are often even counterproductive, such as macro bitswap tricks, math-approximation functions, manual loop unrolling, etc, just assuming that they help, rather than things that actually help, found via testing.

    --
    When was the last time you ran anywhere? I mean with your own legs, not by pressing 'X'?
  148. Re:Simple by LWATCDR · · Score: 1

    So my statement that STL is great if you can afford the overhead is still true. I never said who could or could not afford it. Honestly I say use it if you can. So what is wrong again. Such a simple statement allows for people to decide what it means.

    --
    See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
  149. I use C# by rhyous · · Score: 1

    I use C# in Visual Studio. C++, yes even C++11, looks like a dinosaur in comparison.

    Even if I am working on FreeBSD or Linux, C# is better. Mono is easy to install and the MonoDevelop is already friendlier than any other open source IDE out there.

    But both Java and C# make C++11 look slow. The syntactical bloat needed to code the same features in C++ compared to C# and Java is just not acceptable.

    It isn't just the language that makes C++11 old. It is the fact that IDEs suck. Visual Studio is so far ahead of all other IDEs that everything else is abysmal. However, VS is not as feature rich for C++ so even C++ on Visual Studio is a pain.

    #1. Fix syntax. If I were to fix C++, I would change the compiler to support hundreds of the C#/Java syntax. Sure it is syntactical sugar, but that sugar is what makes those languages awesome.
    #2. Fix references. Make stupid simple. Check out NuGet and the Java equivalent and implement something. Maybe this is an IDE fix, I don't care. The language is does not stand alone, but the tools around it are important too.

    Now for all Langauges, C++, Java, C#, and others. Make the same freaking libraries with the same signatures.

  150. Works as Intended by Anonymous Coward · · Score: 0

    Works as intened, predictable, well documented.

  151. Simple solution for all Ruby Gems by Anonymous Coward · · Score: 0

    In many environments where I was responsible for there was a simple solution for all those different Ruby Gems, as well as different (incompatible) Java libraries: NOTHING, but really NOTHING gets installed on the system, everything is installed in a self contained root folder (i.e. /opt/) and when I do a system upgrade, and your ruby code breaks, its up to you to fix the project folder. Of course that was tested up front in QA and UAT. Most rollouts of new code are then tar ball drops into the respective folders.

    Even vendors if they write commercial corse can be made to play with those rules. Most seem already to be aware that there are a good number of sysadmin folks out there that look at you as if you are crazy if you want to install anything within the system folders.

  152. Re:Simple by Darinbob · · Score: 1

    I work in embedded systems. Which means slow processors and not enough ram. So before a project even begins there is a need for optimization. Especially when people on the team were previously windows programmers or electrical engineers.

    These are often real time systems, so it is known in advance what parts of the code are critical, and timing is now a requirement and not just something optional. Even in other cases, it is still easier to spend exactly the same amount of time writing efficient code than to write obviously inefficient code, I'm not talking about wasting time that's not necessary and I'm not talking about ridiculously obfuscated C tricks. Ie, even with STL, programmers should know that is it vastly faster to search using a map than a list. You may say that's obvious, but it is not obvious and I have run across people who think even doing that is a premature optimization.

    I have sometimes optimized stuff precisely because customers are complaining.

    I also write run time libraries sometimes. That is, I write the string library functions. What if all the people who wrote run time libraries thought that optimization was a mere luxury, combined with a programer base that naively assumes all libraries are fast? Often I am going back over library code written by other people and getting huge speedups.

    And I do measure the code and determine what it is that is slow and needs improving.

    I do get bugs, however the vast majority of my own bugs come from going to quickly and not slowing down and examining all the consequences and corner cases. Ironic since the primary reason to avoid optimization is to speed up the coding process. Most of the time when I am optimizing existing code I am also fixing up many bugs that are also there, as unoptimized code is very often incorrect code.

  153. Re:Simple by david_thornley · · Score: 1

    The STL isn't some big library you link in. It's a collection of templated containers, iterators, and algorithms that can be used individually. Therefore, I don't understand you.

    It is possible to create bloat by having, say, vectors of many different classes, but if you are careful with what data types you use I don't see the problem.

    --
    "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  154. Re:Simple by david_thornley · · Score: 1

    That's one reason why lots of people don't like iostream. It's heavyweight and a pain to write closely formatted text in. For anything memory-limited, I'd go with stdio.h (or cstdio).

    --
    "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  155. Knowing C != Knowing C++ by ArunSaha · · Score: 1

    In my observation (YMMV), most C++ programmers are former C programmers. The assumption is, "If I know C, then I know C++." In practice, they are just compiling C code with a C++ compiler. Once in a while, they throw in a class to club few function. A lot of "systems" companies have such C-turned-C++ programmers who are unaware of the existence of the books like "Effective C++."

    Another problem is, many C++ programmers go gung-ho with inheritance as if, in C++, they have the moral obligation to use all the different flavors of inheritance and create a deep (messy) hierarchy without analyzing if such complexity is inherently necessary.

    (Long rant truncated)

  156. Re:Simple by tepples · · Score: 1

    Yeah, or a custom wrapper therearound is what I end up using in my C++ projects. It's just that early on, there was a lot of "no true Scotsman" argument going around that using directly wasn't in the "spirit of C++", whatever that means.

  157. STL fundamentally changed C++ for the better. by Anonymous Coward · · Score: 0

    I've been a heavy user of C since 1986, C++ since 1990.
    First, there are a lot of comments here disparaging C++ in favor of something else, Those things are nice, they're fine, most of them would not have come about if not for the C lineage, which has been shaping OUR minds for what 40 years now? I was compiling the gcc stack back in 1992 and it was the most amazing toolchain I'd ever seen at that time, let alone what it is capable of now. The modern compiler solves a lot of the chronic problems (unchecked printf varargs) that were the most error prone (and led to things like "streams"). As for those who have trouble with naked pointers,
    C++ stalled for a while before STL in competition with the OO languages of those days and because we had simply not grokked the utility of generic programming. I have to say that C was still my choice before the STL. C++ would probably have languished had the STL not happened. Anyone who doesn't appreciate STL has never had to debug and unify 14 enterprise-wide C implementations of Linked List to solve a memory leak or add threading to a mission critical high performance application. (yeah, STL containers not thread-safe... but if you use them for what they are and add scoped locking, you'd be surprised! )

    C++ is for C++ programmers. STL is for C++ applications programmers.
    C++ is for C++ programmers and that includes anyone who needs speed and efficiency for a highly complex problem, learn your pointers, learn your heap management or else use shared_ptr (thank you STL + C++11!) and deal with what comes with that. Unless we're all going to port all our complex systems to D or Nimrod, or a handful of other advanced bare-metal languages, then write and publish workarounds, stop arguing against C++, and keep lobbying. It's NOT GOING AWAY no matter how painful it might be to understand, read or write. The codebase includes most of the usable operating systems, compilers, database, and commercial as well as Open applications,

    There are 3 HUGE reasons for that:
    1.) It deals "well enough" with complexity, with a price of requiring a mind that does also. (C does fine, but it's a lot of writing)
    2.) It does not have a VM layer, Interpreter, JIT, or GC to complicate and distract from the task at hand and add (noise, errors, and compatibility issues)
    3.) What do you have? It can work with that. (a purple paisley Intergalactic people eater?, yep, just write the interface. )

    In all those years working with C and C++ my C++ knowledge by the online "tests" still doesn't get past 90%, mostly because the tests cover a lot of corner cases that I have no reason to bother with, (i.e. I'd never write that, it's stupid.) Most of what I do now is maintenance, re-factoring and re-engineering, I'm re-factoring a lot of code that looks like what we used to write in the 90's, in fact it was written in the 90's. In most cases each application contained it's own entire infrastructure layer to deal with interrupt-based I/O, polling directories, reading pipes, shared memory, etc. Organizations I've seen and worked in have had stale, wasteful, flawed and awkward implementations of all those things that MOST applications HAVE TO DO for so long now. There's never time or budget to re-work until something is banging up against the far right edge of the bathtub curve. BUT!!!!! When you DO get to revisit some of these old applications with the STL in your hands, you can tear out huge swathes of unmanageable legacy code. Replace a dozen on-the-fly linked-lists with a vector, deque or whatever actually makes SENSE to use in that case! Replace hundreds of looped in-line tests with lambdas or even with C++98 functors!, add threads that are READABLE, with locking that's not painful!, IO queues that reduce contention! A whole reusable application infrastructure assembled from customized objects! when you're done you NEVER have to deal with one more awkwardly unmanageable C Object again (in THAT codebase anyway, but there are so many more waiting)

    C++ and STL is getting much better ea

  158. Hmmm by Anonymous Coward · · Score: 0

    That's not the c++ the language's fault, that's C++ libraries. The concurrency stuff is a library, it's not yet baked into the language. The async library was a failed experiment. Better things will come. If it was in the language, we'd have a problem. When it does arrive in the language, if, it'll be better.

  159. It's getting better. by Anonymous Coward · · Score: 0

    C++ is getting better. Any non toy language will evolve the same warts as C++. Look at the size of C# now, another great language, but C# took out some good stuff from C++ and didn't replace it with anything better. Making C# at best arguably as good as C++, but without the same code base even it's user base is good, and at worst, C# is well, worse.

    STL is at times hard to use but Concepts will make it *a lot* easier to use. They don't throw stuff away every week like MS do. Even large companies can't afford that attitude.

    Concepts will pave the way for STL to perhaps get augmented with another STL. But that won't happen until it's leaps and bounds better than the existing STL and in the mean time the current STL will become concept based itself and that will improve what we have whilst preparing the ground for something drastically better. But steady evolution is better than boom and bust of new stuff if you're serious about long term projects.

    None of this is to fault C# in particular or any other language or to say C++/STL isn't without it's faults. It's to say that any non toy language goes the way C++ does. Just a lot of other languages get dropped on their head as soon as their main corporate backers loose interest. C++ does have a real community behind it. Time will tell, but C++ has been around a long time and I don't see it going away, and I do see a lot of practical evolution occurring without throwing everything away each time.

  160. Ha ha by Anonymous Coward · · Score: 0

    Can I say I love using C++ whilst totally agreeing with you. I'm not sure what that means except playing with grenades is fun perhaps. I switched to C# a long time ago and switched back to C++ recently. Life was productive in C#, but far too boring!

    1. Re:Ha ha by MadKeithV · · Score: 1

      Taking a page out of badanalogyguy's playbook, I compare it to a hand-built high performance racing car. It's really fast, but when you're driving it close to the edge of its performance it's twitchy as hell and you need a lot of experience to keep it from breaking out and careening off the track. A professional driver can make it do things you didn't even know were possible, and when you try to do the same following a detailed description you spin it out of control time and time again. It doesn't start with an ignition key, you need to flick a bunch of arcane switches in a complicated order to start all the car subsystems. When something goes wrong an unlabeled lights display looking straight out of Space:1999 lights up, and while the errors are described in the huge manual they are still so vague that you only begin to understand the errors after about the 10th time you've seen the same one. And whenever it needs maintenance or extension it turns out that someone manually hammered and bent the standard parts inside to fit, and nothing you can buy fits straight in without adaptation.

      But man, it feels great when you run that thing around fast bends doing a great lap time. It doesn't really get you anywhere, but it makes you feel invincible.

  161. If it works... by Meski · · Score: 1

    It's nice to write in and use STL, but if you have to step thru and debug it it's a fscking nightmare.

  162. Re:Simple by Pseudonym · · Score: 1

    The third rule is usually quoted as "don't optimise until you've profiled".

    But I would add two important rules:

    1. If you must optimise something while coding, optimise your internal APIs and your automated tests. That way, when you a performance problem, you can swap code out, swap new code in, and everything should just work.

    2. The best time and place to do optimisation is often before you write code, on the back of an envelope.

    --
    sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
  163. Re:Simple by serviscope_minor · · Score: 1

    So my statement that STL is great if you can afford the overhead is still true.

    Seriously, I still don't understand. If you need a priority queue in your program, you need a priority queue. I don't see how the STL implementation of a heap has any more overhead than a by hand implementation.

    Such a simple statement allows for people to decide what it means.

    Yes, but I want to know what *you* mean by it.

    --
    SJW n. One who posts facts.
  164. Re:Simple by LWATCDR · · Score: 1

    If the system can afford to STL then you should use STL. Even if you can not use some parts of STL because they are too heavy, use what you can.
    I don't see the confusion. STL is great if you can afford the overhead. What part of STL is great do people not understand? If are talking just about PCs then you can probably always use STL. The reason that I say probably is there maybe some off the wall real time application running on a PC somewhere that just cannot use STL for some reason. I would not say always because goodness knows that someplace there is an use case I do not know about.

    --
    See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
  165. Bullshit by Anonymous Coward · · Score: 0

    A million lines of code in 10 years would be childs play if you're a real pro.

  166. Re:Simple by Megane · · Score: 1

    But it remains the case that many of C++'s features can be used on those types of devices, and smaller ones too, and that includes templates.

    True. And I have done it. I even overrode operator new to allocate out of pre-allocated memory pools. And indeed, the type of stuff you put on such a thing doesn't usually have much need for templates. The one template I did use is a bitmap (as a collection of bools, not bitblt) class, with the number of bits as the only template parameter.

    But you're certainly never going to running Java or anything else on those things.

    Well, at some point someone thought it was a good idea. But there was the little problem that ARM intentionally has not released all the necessary documentation.

    --
    #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
  167. Coder by Anonymous Coward · · Score: 0

    I will definitely try it out! iDroidSpace

  168. LCM by Anonymous Coward · · Score: 0

    The STL is very useful and incredibly fast and has gotten faster due to the new move operator semantics made available in C++11/C++14. At our institution, we use a search application that needs to do custom searches and retrieve results quickly. The application was at first written in java and a typical search took about twenty minutes. It was rewritten using C++11 specially taking advantage of the move semantics and the search times went down from twenty minutes to 3 or 4 seconds.