back to article Bjarne Again: Hallelujah for C++

Now it has been scientifically demonstrated that we Delphi users are the happiest of all programmers, proper significance can at last be attached to the rare woes that occasionally break through our Stepford Coder personas. My test case: Warren Postma, a Delphi-head, was recently forced out of his comfort zone to repair a C++ …

COMMENTS

This topic is closed for new posts.
  1. This post has been deleted by its author

  2. Whitter
    Flame

    The usual non-USA cost bias.

    On amazon; $50 in the USA; £42 in the UK. After taking postal rates into account, I'll still be ordering from the USA.

    Nobody's going to spin that there's an overt difference in marketing budgets or support costs in a book,. Or if they do, can somebody please shoot them?

    1. Tom 7

      Re: The usual non-USA cost bias.

      I guess they must think words are worth less in the US of A.

      Which may be true.

      1. quad50

        Re: The usual non-USA cost bias.

        Its not that. we pay for our healthcare separately, rather than roll the cost into everything we buy and whatever money we make. how it works out is open for discussion.

        1. Tim99 Silver badge
          Coffee/keyboard

          Re: The usual non-USA cost bias.

          @quod50

          You might be surprised to find that the US government spends more per capita on health at $4437 compared to $2919 for the UK. The USA in total spends 17.9% of GDP compared to 9.6% for the UK. This is, perhaps, the price that you pay for having one of the least efficient health systems in the world. You do however spend even more on military spending.

    2. Yet Another Anonymous coward Silver badge

      Re: The usual non-USA cost bias.

      Funnily enough for most textbooks it's the opposite way around, they are $200 in the USA and £40 in the UK

      Based on, if your are paying $50k in tuition you won't mind a few $100 on books

    3. ThomH

      Re: The usual non-USA cost bias.

      But it's currently selling for a third below its usual price on Amazon US and only 12% below its usual price on Amazon UK.

      The US price is ordinarily $75, which is £47.98 at today's exchange rate. The normal UK price is £47.99. Once you add some tax, it ordinarily costs more in the US.

    4. Anonymous Coward
      Anonymous Coward

      Re: The usual non-USA cost bias.

      So you're ordering a book from overseas in order to pay less?

      That's STEALING!

  3. Tom 7

    If you want to get by with something smaller

    choose something with a smaller problem space than computing.

  4. Gary Walker

    £43? Really?

    1. Number6

      Yes, really

      It's economics. How many are they going to sell, how much does it cost to do all the up-front work such as proofreading and such like, how much does the author get paid, what's the cost of the print run, distribution, etc.

      For non-fiction books they don't expect to sell many, plus they're often big and heavy and so the material cost is higher, as is that for distribution.

  5. James Thomas

    STL algorithms

    I never used these either - until Lambdas. Now that you can use and algorithm on a single line they have become very handy.

  6. Spoonsinger
    Coat

    Re "'The most awesome thing about Delphi is that it is not C++"

    The nice thing about Borland C++ Builder, it was/(is?), able to quite happily compile Object Pascal as well as C++. Quite nice if you didn't want to rewrite something - probably a bit of a problem for someone not well versed though.

    ps

    Sorry for whoever had to take up my code :-)

    1. AndrueC Silver badge
      Thumb Up

      Re: Re "'The most awesome thing about Delphi is that it is not C++"

      Yeah I liked Borland Builder. I was a member of TeamB (yes, that Andrue) for while but my employer got taken over and the new guys used Visual Studio so that was that.

      What I miss most is the VCL. Okay so it wasn't totally standard C++ but it was a near joy to use. Suddenly I was plunged back into the unpleasant world of the resource editor and MFC's idiosyncratic class hierarchy. Eventually we got introduced to some C# projects and I was back in the friendly world of Anders Hejlsberg. C# is pretty good when you get used to it but you don't get that hand-crafted precision code feel that you do with C++. And dear Gawd give me RAII over Garbage Collection any time :(

      But back to topic. I like C++. Written well with good use of templates, copy ctors and const it can be quick to write, easy to maintain and safe to execute. It's just unfortunate that most developers prefer to cut corners and churn out questionable code.,

      1. Spoonsinger

        Re: "What I miss most is the VCL"

        Indeed, it's not the language which is the issue in most circumstances, it's the libraries, and VCL was/(is?) tops. Trouble with current C# stuff is that you have totally laid back ex-Delphi bods mixing with MFC bods who have years of soggy chips on their shoulders. (IME). It was a simpler time back then :-)

      2. Luther Blissett

        Re: "most developers prefer..."

        Have you ever seen what Cobol programmers do when allowed a C compiler? </shudder>

      3. Someone Else Silver badge
        Happy

        @ AndrueC -- Re: Re "'The most awesome thing about Delphi is that it is not C++"

        First: Andrue...nice to finally meet you!

        Second: I, too, miss VCL. However, I've found the Qt makes an ample and reasonable replacement.

  7. Paul Shirley

    "The most awesome thing about Delphi is that it is not C++"

    Surely the most awesome thing about Delphi was that it wasn't classic Pascal and conceded you might want applications that talk to the messy outside world and run at decent speeds... all things missing from the language when I was forced to learn it at university ;(

    1. Spoonsinger

      Re: "The most awesome thing about Delphi is that it is not C++"

      Nowt wrong with Pro-Pascal either, (just needed a bit of assembler to fill in the blanks). Still love the language - a bit like a dog going back to and old piece of spew.

      1. thondwe

        Re: "The most awesome thing about Delphi is that it is not C++"

        Pro-pascal - now there's a compiler with bugs in!

    2. Anonymous Coward
      Anonymous Coward

      Re: "The most awesome thing about Delphi is that it is not C++"

      And Paul, ObjectPascal laid the foundation for that. I still have a copy of that somewhere...

      ;-)

      1. Anonymous Coward
        Anonymous Coward

        Re: "The most awesome thing about Delphi is that it is not C++"

        It was being told not to program in Delphi any more, by a former beloved employer, that put me off programming for life. My Delphi days were happy days, and going back to C, Informix and VB (ugh) made me utmost grumpy.

        I can't say I'm unhappy with the outcome though.

  8. Anonymous Coward
    Flame

    About The Awe For Templates

    Using the C++ template language like a full programming language is very much like using the BrainFuck language:

    http://de.wikipedia.org/wiki/Brainfuck

    You can do it, but there are usually much, much better ways of doing compile-time code generation:

    A) Use a proper macro language such as M4. I venture to say that in 99% of cases that is all you need. Expand the code onto disk and have proper error messages that can be used by your IDE to jump right to the faulty parametric code. Massive, successful and well-performing systems like CATIA use this approach instead of templates.

    B) Use a plain C++ program to generate some other C++ code. Call that generator from a make file like you call the m4 macro processor. That spares you to dive into Brainfuck/teamplate language.

    Generic code and code generation are not mystical things, they are actually quite straighforward as soon as you remove the C++ Brainfuck variant from the whole story. There is absolutely no need for weird and difficult-to-decipher error messages of you use the approach from above.

    But hell yeah, you need to question the holy gods (who are as jealous as that other jealous middle east god) of the C++ standards committee.

    1. Tim Parker

      Re: About The Awe For Templates

      God Lord ! Whatever C++ faults (and there are many), M4 is not the answer... although to para-phrase "The most awesome thing about M4 is that it's not autoconf".

      *shudder*

    2. Anonymous Coward
      Anonymous Coward

      Re: About The Awe For Templates

      "Use a proper macro language such as M4."

      I thought you were contrasting to Brainfuck?

      IMHO, I don't find M4 to be a very pleasant entity to work with - I think the syntax is fairly ugly, and I really wish somebody would come up with a cleaner macro expansion system.

      But I will agree, compared to template meta-programming, M4 is a breeze - but then, almost anything will come out better in that comparison.

      I really wish the C++ standards bearers would provide a cleaner way to do what SFINAE and boost::enable-if did - concepts would have been nice, but event they get fugly in the implementation.

    3. BlueGreen

      Re: About The Awe For Templates

      I don't know enough to compare it with templates[*], but Yay for M4! It even works in other language, astonishingly! (I've used with jscript). It's an all-round handy tool.

      There are good reasons for folding a (subset of a) preprocessors capabilities into the language - basically you can be assured of a parseable syntax and determinable semantics - but preprocessors have gone out of fashion and it's a shame. They have their place.

      @David D. Hagood

      What's wrong with the M4 syntax in your view? Other than not having named params, I agree, but one could probably fix that within M4 with a bit of effort.

      [*] been a long time since I tried to follow the ever mutating standard, and I'm damned if I'm going back to that dog's breakfast of a language now.

      1. Anonymous Coward
        Anonymous Coward

        Re: About The Awe For Templates

        It's been a while since I've worked with M4, mostly in the context of autoconf, but trying to remember when things would be expanded, when they would be recursively expanded, and conditionals were all lots of no fun in making a reasonable autoconf work.

  9. Anonymous Coward
    Stop

    Actually

    I have been lying a bit about CATIA. They use plain C macros for their container classes. That works well enough but it would work even better if they used m4.

  10. Anonymous IV
    WTF?

    Hmmm. Verity's gone a bit technical, what?

  11. Charlie Clark Silver badge

    Multiple inheritance

    Are there readers out there who own great farms of mixin classes, yapping and baying from within their barbed wire enclosures?

    Multiple inheritance is reasonably common and painless in Python and gets used where it's appropriate. I'm personally not a great fan of "mixins", which I would define as classes that have no standalone instances, per se but they have their uses. At the end of the day you have to be able to understand your object hierarchy and delegation patterns in order to be able to debug it. And if you can remember that you might be debugging somebody else's code then you might be tempted to write more verbose but clearer code, including class genealogy.

  12. Anonymous Coward
    Anonymous Coward

    C++

    The triumph of syntax over clarity.

    A bad language from a bad language designer.

    1. Kristian Walsh Silver badge

      Re: C++

      Counterexample to back up your assertion, please...

      1. Anonymous Coward
        Anonymous Coward

        Re: C++

        Counterexample? Smalltalk from Alan Kay et. al.

        Java, for all its sins in the class library, is still a more elegant programming language than C++.

        1. Dan 55 Silver badge
          Trollface

          Re: C++

          Elegant if you define elegant to mean bureaucratic, because someone at Sun thought you can't drag a variable's value through too many type conversion methods so each one can have its go at rubber stamping it.

          1. Anonymous Coward
            Anonymous Coward

            Re: C++

            @Dan 55 - Sounds like you're doing it wrong then. The type erasure in Java's generics may be a crap implementation, but at the syntax level it removes the need to cast. Looking at the last large Java code base I worked on, the static analysis checker indicates that the only place casting is necessary is in some reflection code used at application startup and in the caching layer. Autoboxing may also be less than ideal for efficiency, but it still leads to cleaner syntax - compared to C++ where copying is rife in the idiomatic use of STL even for objects.

            1. Anonymous Coward
              Flame

              Re: C++

              Comparing Java and C++ is like comparing an Oxcart and an A380. Driving oxcarts is much easier and less dangerous, you know.

              1. Anonymous Coward
                Anonymous Coward

                Re: C++

                C++ is more like a Nimrod - it may still be able to fly, but so many bits have been tacked on over the years and it's still a crappy old Comet underneath.

                1. Anonymous Coward
                  Stop

                  Re: C++

                  Even Nimrods can do much more than oxcarts.

        2. Marco van de Voort

          Re: C++

          The problem with elegant languages is that they mostly meant to be displayed, not to be used :-)

        3. kraut

          Re: C++

          Smalltalk is wonderful. And wonderfully successful.

          Java is

          a) tedious and verbose to the extreme

          b) ugly and less expressive than C++

          c) not a systems programming language in the same sense that C++ is.

          IMHO. YMMV, etc pp.

    2. Ben Hanson 1

      Re: C++

      Bjarne Stroustrup: "There are only two kinds of languages: the ones people complain about and the ones nobody uses."

      One day there will be a worthy successor to C++. We would have one already if this industry wasn't so keen on naval gazing. It will not include garbage collection (gosh, imagine that!)

      1. Anonymous Coward
        Anonymous Coward

        Re: C++

        " if this industry wasn't so keen on naval gazing "

        What does shipspotting have to do with this?

      2. Destroy All Monsters Silver badge
        Thumb Down

        Re: C++

        > It will not include garbage collection

        Enjoy you pointer shit and manual deallocation errors.

        1. Richard 12 Silver badge

          Re: C++

          RAII and the appropriate smart pointers make it damn near impossible to forget to deallocate - the data is gone the moment the last reference drops out of scope.

          RAII predictable, while garbage collection is anathema to predictable timing. If repeatable performance doesn't matter for your project that's fine, but not everybody is doing that kind of stuff.

          TBH I find it hard to come up with a valid reason to prefer GC over RAII - why would you want the object to get erased some random period after you don't want it anymore? Why not kill it now?

          Aside from all that, you still get memory leaks in garbage-collected languages, it's just a case of holding onto references you don't actually need anymore, or otherwise confusing the GC into thinking you might still want it.

          You can shoot yourself in the foot in any language.

      3. mrjimorg

        Re: C++

        "One day there will be a worthy successor to C++"

        That's how I feel about C :)

    3. Tim Parker

      Re: C++

      "A bad language from a bad language designer."

      ..if not a bad language designer, i'd certainly go for 'bad language user' - I present as proof the 3rd edition of his tome in which he uses the English language in a manner which is a very long way away from it's normal role of passing information from one person to another. Horrific book - the absolute antithesis of "The C Programming Language" by K&R (some might suggest this may also stretch a little further to the languages themselves - I couldn't possibly comment).

      1. kraut

        Re: C++

        I haven't read the 3rd edition recently, but I've always found Bjarne an exceptionally good writer. Absolutely loved "Design and Evolution of C++" - IMHO one of the best and clearest programming books ever.

        Also: How's your written Danish?

      2. Anonymous Coward
        Anonymous Coward

        Re: C++

        "I present as proof the 3rd edition of his tome in which he uses the English language in a manner which is a very long way away from it's normal role of passing information from one person to another. Horrific book"

        Yeah; easily the most badly written computer book I ever bought. The man's a menace to languages of all sorts.

    4. Anonymous Coward
      Anonymous Coward

      Re: C++

      > A bad language from a bad language designer.

      Says who, please?

  13. Lee D Silver badge

    Woah. I still stick with my opinion that C99 does everything I could ever want to do, with poking by myself or others, and still is quite obviously readable is written correctly.

    All that junk in the article (and &&? Really? Why not choose something not already overloaded to confusion?) to do simple things? It might be more efficient and keep the CS guys happy, but honestly it's just a mess.

    And when messing with shared memory, I'd much prefer to know exactly what the hell is going on or pass off to a library that knows. Not the middle ground of "here's something you can use, but be careful with it".

    "200 lines of angle-bracketed, colon-riddled gibberish."

    Pretty much sums up my feelings about C++.

    1. Anonymous Coward
      Stop

      Nobody forces C++ aspects you do not know onto you. Start out with your style and slowly appreciate things like destructors, RAII, simple parametric/generic code, type safety and the like. There will be a time you will even like some amount of operator overloading.

      Use it in a smart way, know what you do and you will love it.

      1. Hungry Sean
        WTF?

        @alterntative HUH???

        Say what? Let's say your team is happily working in a nice C89 environment, cranking out good code. Some function outside of you is going haywire. Now you've got to dive in. Turns out it's a C interface to a C++ monstrosity. Now it's your problem to figure out exactly what is going on.

        Or, in a different situation, you get happy with some particular subset of C++, change jobs, and now you're working with a group of people who like some other subset. Hope you can figure out the mess right quick.

        My point being that individual engineers don't get to choose how a massive language gets used. If you do work that has any potential to expose you to C++, all of the dark corners will present themselves as punishment unto you at some point through no fault of your own. And there isn't even consistent agreement about what parts of the language count as evil as far as I can see.

        And no, I will *never* love c++. I'd rather save my cleverness for solving problems than fighting a language.

        1. Anonymous Coward
          Anonymous Coward

          Re: @alterntative HUH???

          In my case it was a lovely C99 codebase, and then we needed to integrate CORBA for RPC and messaging. Turns out our C code tickled the places where C++ is not quite a superset of C ...

    2. Ken Hagan Gold badge

      "(and &&? Really? Why not choose something not already overloaded to confusion?)"

      Care to suggest something? For added points, ensure that your suggestion is syntactically brief (because rvalue references are intended to be used in end-user code, not buried in the magic parts of some library), is conveniently representable in all national character sets of note (for the same reason), does not involve any alphabetic keywords (because at this stage in history the chances of you *not* conflicting with several squilion lines of existing code are precisely zero), and ideally "reference-related" (at least in the minds of long-term C++ programmers, who I'll concede have probably developed a different aesthetic from most folks).

      && is brief, ASCII, syntactically distinct, and (to a C++ programmer looking at a function declaration) clearly something to do with references. Of all the syntax contortions in C++, I'd say you were picking on one of the least unpleasant. Now if you'd been slagging off lambdas...

  14. Anonymous Coward
    Anonymous Coward

    Template meta-programming

    If I ever had to recruit people for a C++ team, then my ideal test would be to have them read Alexandrescu's "Modern C++ Design" (a book title that breaks the trade descriptions act) and offer their opinion on it. Any candidate who said template meta-programming was a great idea after reading that would be out the door pronto.

    1. Anonymous Coward
      Anonymous Coward

      Re: Template meta-programming

      I know exactly what you mean. It is a fabulous book - as a spectacle.

      If you understand it - you are a genius.

      If you use it - you are an idiot.

  15. T. F. M. Reader

    Yapping, baying, and mixing in without barbed wire interfaces

    "Are there readers out there who own great farms of mixin classes, yapping and baying from within their barbed wire enclosures? Do tell."

    Well, I usually get to multiple inheritance after no more than 20 minutes of thinking of any non-trivial problem. Mixing in functionality is amazingly useful, concise, and elegant when designed properly, especially when you already have a body of code that you do not want to (or cannot) redesign. The argument of the difficulty or error-proneness of multiple inheritance goes away when it meets proper design.

    As for yapping and baying, try to - really! - think, e.g., of the typical textbook class hierarchy of the animal world that would attempt to approximate the actual diversity of species. Don't stop where textbook examples stop. Model the reality. You will likely find out that *interfaces* like Fly() or Swim() or whatever, which is what Java marketoids try to push down our throats as a substitute for multiple inheritance will not suffice without major contortions: you want to inherit implementations and modify them only when necessary.

    1. Charlie Clark Silver badge

      Re: Yapping, baying, and mixing in without barbed wire interfaces

      Don't know who voted you down without an explanation. It seems that inheritance is much misunderstood. I could add "like so much in programming".

  16. Anonymous Coward
    Anonymous Coward

    Any programming language is a tool

    A tool should be easy to use and understand, with no complexity or ambiguity, so that you can concentrate on the problem at hand.

    1. Tom 7

      Re: Any programming language is a tool

      And if its easy to understand then it will only be suitable for easy to understand problems with no complexity. Either that or you will have to write the hard to understand bits in the language of your choice - which someone has had a good bash at in C++11. Whichever approach you take there is some point where you will have painted yourself into a corner and the only way out will be to actually understand the problem. You may find the syntax of C++11 ugly but it does the job. Complaining about the syntax is a bit like claiming you didn't understand a document cos its in Comic Sans, or that Pi really should be 3 to avoid confusion.

      1. Anonymous Coward
        Anonymous Coward

        Re: C++ syntax

        At least they fixed the need for space in > > when using nested templates. How that ever made it into the wild (along with the vector<bool> screw up) I'll never know.

      2. Anonymous Coward
        Anonymous Coward

        @Tom 7 (Re: Any programming language is a tool)

        If you were undergoing open heart surgery, would you prefer your surgeon to use a complex and difficult to master tool that many people have not properly mastered? Or would you rather he used a scalpel, so he could concentrate on saving your life, without being distracted by the idiosyncrasies of his equipment?

        1. M Gale

          Re: @Tom 7 (Any programming language is a tool)

          You think a scalpel is the only weapon in a surgeon's arsenal?

          Do you think a CBP pump can be used by any plonker who can hit a red button?

          Does your most complex program go something like std::cout << "Hello, World" << std::endl;?

          If so, then yes, C++ is probably not the language for you.

          1. Anonymous Coward
            Anonymous Coward

            Re: @Tom 7 (Any programming language is a tool)

            "Does your most complex program go something like std::cout << "Hello, World" << std::endl;?"

            One of my most complex programs was a preemptive real time scheduler with associated library. I wrote it in C and assembly language, both of which are much simpler than C++. Can you save and restore registers, disable/enable interrupts, do efficient bit manipulation and simple atomic operations in C++? (That's a rhetorical question.)

            I am not violently against C++, in fact I have used it for many years. I just don't think it is a particularly good language, because despite its power it has a horrible syntax, lacks elegance and is far more complex than it should be.

            The ideal programming language would in my view have the power of C++ and the simplicity of C. Is that possible? I don't know, but I like to think it is. We are a long way from that.

            1. Anonymous Coward
              Anonymous Coward

              Re: @Tom 7 (Any programming language is a tool)

              "I wrote it in C and assembly language, both of which are much simpler than C++."

              Amen, brother. I suspect that the C++ rah-rah team on here has never actually used another language. It's garbage. Uncollected garbage at that.

              1. Ben Hanson 1

                Re: @Tom 7 (Any programming language is a tool)

                "I suspect that the C++ rah-rah team on here has never actually used another language. It's garbage."

                Don't be daft. Anyone old enough to remember the introduction of C++ has highly likely coded in both assembler and C. I really couldn't speak for the younger generation, but don't most of them code in C# or Python anyway?

            2. Someone Else Silver badge
              WTF?

              Re: @Tom 7 (Any programming language is a tool)

              Can you save and restore registers, disable/enable interrupts, do efficient bit manipulation and simple atomic operations in C++?

              Short answer: Yes. Next question?

              (That's a rhetorical question.)

              Really? Then why bring it up when you know (or should know, since you "have used it for many years") the answer already?

      3. Anonymous Coward
        Anonymous Coward

        Re: Any programming language is a tool

        "Pi really should be 3 to avoid confusion."

        Priceless!

      4. kraut

        Re: Any programming language is a tool

        Of course, the chance that anyone who uses Comic Sans for documents would write documents that make sense is negligible.

    2. M Gale

      Re: Any programming language is a tool

      Unfortunately when the tool in question can perform a bewilderingly huge array of different tasks, it can end up requiring an expert to wield it properly. C and C++ are systems languages, meant for doing all that low level nitty-gritty at tremendous speed while abstracting the need to use an even more bewildering set of Assembler routines behind a language that is at least understandable, even if it doesn't hold your hand for you.

      CNC milling machines are tools, but you ain't going to be good at using one if your only experience is a Black & Decker hammer-action.

      1. greensun

        Re: Any programming language is a tool

        Programming languages ( anything ) should be as complicated as they needs to be to do the job, but no more.

        Does anyone here really think C++ is that ?!

        C++ is stuff grafted onto stuff grafted onto stuff grafted onto stuff grafted onto C, with each grafting adding complications solely to desperately try and retain backward-compatibility.

        Because C++ is the result of that, it is a bloody mess.

        1. Ken Hagan Gold badge

          Re: Any programming language is a tool

          "C++ is stuff grafted onto stuff grafted onto stuff grafted onto stuff grafted onto C, with each grafting adding complications solely to desperately try and retain backward-compatibility."

          For the C subset, C++ is demonstrably cleaner than the C it came from. I say "demonstrably" since most of the features added to C since '89 have come from C++. As for the non-subset: no-one is forcing it on you. You can use C++ as a cleaner C99 or cleaner C11 if you like. What you don't use, you don't pay for. It's one of the guiding principles of the language's evolution.

    3. Someone Else Silver badge
      FAIL

      Re: Any programming language is a tool

      My ol' man's 40's-vintage metal lathe is a tool...but it is by no means easy to understand or unambiguous. Yet he, and my brother, can both perform quite complex operations with it, and get magnificent results. In the meantime, I'd probably break something expensive with it.

      Don't confuse the complexity of the tool with the lack of skill of the person wielding it

  17. Infernoz Bronze badge
    WTF?

    What flannel about VM languages etc.

    C++, Delphi, been there, switched to Java, because it's plain better and quicker for most stuff.

    Big deal about Boost, Java 1.7 already has pretty much the same /built-in/, in a much safer garbage collected environment, has much better built-in and vast 3rd party libraries, better debug, profiling and test support, with dynamic runtime optimisation which can beat C++ code. Even the relatively old Java 1.5 has powerful Thread and direct access capabilities. The powerful Maven repository and build system, is written in Java, and makes IDE project builds, Perl CPAN, and *Make look primitive. The Java VM can run other languages like Scala which can use Java libraries, and makes C++ look even more primitive and over complicated.

    The dotNet VM has some similar capabilities to the Java VM, which is why Microsoft have shifting a lot code off native C++ onto dotNet.

    We don't need C++ for most sophisticated applications now; it's mainly better for lower level "direct metal" service and platform code e.g. OS kernel, device drivers, and some services. OS Services can already be written in for Java e.g. Tomcat and I've written some myself.

    1. Anonymous Coward
      Stop

      NOT

      I bet 10 Euros you are one of these OLTP programmers: All the difficult work is done in some SQL statements your java code lobs at the C or C++ based database server. Your Java code does some trivial data massaging as compared to the RDBMS, which needs to churn through gigabytes in a few seconds.

      So, yes, for some types of applications (which I called "OLTP" here), Java is definitely the right tool and the rightful cohabitor of Cobol in the datacenter. But the software world is much, much larger than that. Imagine people running software in aircraft or satellites, where every tranistor uses scarce space, scarce payload and scarce power while generating heat that must be carried outside the craft.

      Imagine people doing OLAP, which these days means crunching terabytes of data. Imagine people processing hundreds of megabytes of radar data per second. Imagine people who have hard realtime requirements, because their brake needs to react in less than 10ms - ALWAYS.

      1. Anonymous Coward
        Pirate

        Re: NOT

        Or imagine being NSA. You need to snoop on millions of facebook messages per second in a router which does not belong to you. A server you acquired by a buffer overflow and which provides limited hardware resources to you, as you don't want to tip off its owner towards the existence of your parasitic collection system on their hardware. You see, sometimes you need to be really thrifty !

        1. Mark 65

          Re: NOT

          "A server you acquired by a buffer overflow"

          and what language was used to present that opportunity?

          1. Anonymous Coward
            Anonymous Coward

            Re: NOT

            and what language was used to present that opportunity?

            The Java VM, of course. What else is ubiquitous and horribly, horribly flawed?

      2. Destroy All Monsters Silver badge
        Headmaster

        Re: NOT

        > people running software in aircraft or satellites

        Here's a hint. Mr. Alternative: Use Ada in that case. Or a subset of C. C++ will be verboten as per requirements.

        Any further questions?

        1. Bronek Kozicki

          Re: NOT

          C++ will be verboten as per requirements.

          I'm sure US military will appreciate your input, next time.

    2. asdf

      Re: What flannel about VM languages etc.

      Yes Java can be a useful tool in many instances (RAD and all that, security in the vm not so much) but people would be stupid to limit themselves only to it. Personally I like a language powerful enough to do system programming at the OS level as well as being able to do higher level stuff. Right tools for the job and all that but imho somebody can't call themselves a professional developer if they only can develop managed code or web crap. Its like only being able to drive an automatic transmission car and calling yourself a race car driver.

    3. M Gale

      Re: What flannel about VM languages etc.

      We don't need C++ for most sophisticated applications now; it's mainly better for lower level "direct metal" service and platform code e.g. OS kernel, device drivers, and some services.

      And computer games, graphics engines, simulations, and anything else that needs the speed more than it needs to be developed in 5 minutes.

    4. Ken Hagan Gold badge

      Re: What flannel about VM languages etc.

      "The dotNet VM has some similar capabilities to the Java VM, which is why Microsoft have shifting a lot code off native C++ onto dotNet."

      Microsoft have shifted almost nothing to .NET. They've written vast "libraries" that are thin .NET callable wrappers around the base OS facilities. They've written extensive development tools to let other people bet the farm on .NET. (Irony alert! One of the exciting new tools for .NET developers in VS2013 is a memory leak finder: http://coolthingoftheday.blogspot.co.uk/2013/06/teched-na-2013-day-1-announcement-round.html.)

      But shipping products? Nah. All the stuff they actually make money on is native code.

      1. asdf

        Re: What flannel about VM languages etc.

        >But shipping products? Nah. All the stuff they actually make money on is native code

        With this TIFKAM stuff they are really pushing now they are not even pretending .Net is relevant and the future any more.

  18. Anonymous Coward
    Anonymous Coward

    re: When something goes amiss,

    When something goes amiss, dribbling dullards like me get showered with cryptic error messages and angle brackets, and we don't like it.

    Try STLFilt.

    1. Tim Parker

      Re: re: When something goes amiss,

      +1 on STLFilt. It's very irritating that it's the compilers that add to the pain in the most part, HPs aCC used to manage errors in general rather well (and its output seems to have be pretty much copied by clang, which is a good thing) - the C++ errors were still prone to being cryptic but nothing like the the unhelpful garbage that GNUs C++ compiler forces on you (it's not the only one).

      Much as I love the GNU compiler chain (it's still really rather good, especially at the price) I can't help thinking the compiler error output has been specially crafted to inflict the maximum pain whilst seemingly providing helpful candidates which on closer inspection that appear to have been chosen at random then run through a hash.

      That a 3rd party utility like STLFilt exists and is orders of magnitude more instructive (IMO) than the compilers themselves does seem rather depressing.

  19. asdf
    Mushroom

    holy war fire flinger

    If I had to give advice to any comp sci student it would be learn C++ early. If you can use C++ effectively (main features and patterns) you will have no other problems learning the technology du jour of the month that won't be around in decade (cough Ruby on Rails, etc). Even though I first learned the language decades ago in school when templates weren't even standardized yet I will probably still have gainful employment a few decades from now due to that knowledge. I have worked with many other languages/technologies over the years but still find myself writing psuedo code with curly brackets and STL functions.

    1. M Gale

      Re: holy war fire flinger

      Absolutely.

      Back when I was doing the "Access to Business IT" course, where we got to see if we were good enough to even start a compsci-related degree, the programming module was split up into two groups. Both groups studied VB and C (plain, vanilla C), but they did it in reverse to each other. I was in the group that did C first. The other group did VB first.

      By the time it came to switch languages, my group jumped into VB like a duck jumps in water. The VB group moving onto C took one look at constructs like "int variablename" (what.. you have to tell it what you want to store!? WTF is an int anyway!?), and collectively shat themselves.

    2. Someone Else Silver badge
      Thumb Up

      Re: holy war fire flinger

      technology du jour of the month

      Priceless.

      1. asdf
        FAIL

        Re: holy war fire flinger

        Bah never was big on Frenchy words. You know what I mean and if I butchered one of their foo foo words so be it. I guess I was supposed to just use du jour alone without the month part to be grammatically correct when talking about fads.

    3. Anonymous Coward
      Anonymous Coward

      Re: holy war fire flinger

      "If I had to give advice to any comp sci student it would be learn C++ early. "

      Presumably so that if they design their own languages they'll have a huge list of mistakes to avoid. Like not having garbage collection for decades while pretending your language is object oriented.

      "I will probably still have gainful employment a few decades from now due to that knowledge"

      Yes, because shit software will need more maintenance for longer. What a total waste of money.

  20. Anonymous Coward
    Anonymous Coward

    You likely -are- going to manage it in Java, with a few Thread objects and the correct use of synchronized (or volatile) keywords, in far less effort that C++ regardless of what libraries you use. I'd take a language with first class support for threads and a coherent memory model over something kludged in via a third party library any day.

    1. This post has been deleted by its author

    2. Ken Hagan Gold badge
      FAIL

      "I'd take a language with first class support for threads and a coherent memory model over something kludged in via a third party library any day."

      I'd refer you to the relevant sections of the C++11 standard, but I don't suppose you really want to learn. Executive summary: C++ has both of those things. Life is short and there are too many languages to attempt even a cursory study of all of them, but if you don't know that the very features you ask for are two of the headline additions to the language you are criticising, you end up looking at bit "uninformed".

    3. James 47

      Yes but if you want to match the performance that C++ gives you you need to start using sun.misc.Unsafe

      1. Destroy All Monsters Silver badge
        Facepalm

        > Yes but if you want to match the performance that C++ gives you you need to start using sun.misc.Unsafe

        Why are people from introductory courses on leet programming posting here?

  21. xpusostomos

    OMG

    So C++ is actually 2 turing complete languages: the language itself, and the template system.

    When will everyone just use lisp and be done with it?

    1. asdf
      Trollface

      Re: OMG

      Template Meta Programming is really its own language. It even looks like it with angle brackets all over hell in it like parentheses in lisp or something.

  22. Tim99 Silver badge
    Coat

    If God had meant us to use C++

    He wouldn't have given us C.

    As I started with FORTRAN, you may ignore my comment - It permanently distorted my reasoning.

    1. Uncle Slacky Silver badge
      Thumb Up

      Re: If God had meant us to use C++

      If it can't be done in FORTRAN, it's not worth doing.

      1. kraut
        Happy

        Re: If God had meant us to use C++

        Real programmers can write FORTRAN in any language ;)

    2. Long John Brass
      Flame

      Re: If God had meant us to use C++

      Count yourself lucky

      I taught myself basic back in the day (when an 8k machine was big)

      Then at Tech I learned COBOL, RPG-II & second year PL/1, Pascal & PDP-11 assembler

      I think the COBOL & RPG-II stuff did me real harm :)

      First job was working with DataBus from DataPoint (Imangine a cross between COBOL & Assembler, combining the worst elements of each)

      I liked PL/1 though; But once I started playing with C my life started to detox; Never managed to fall in love with C++, the Syntax was too much like a TECO command line

  23. zaxebo1
    Happy

    use haxe language to generate C++

    One can write in haxe language , which loooks like ActionScript/C# like language. And it will generate code in C++ (and Java/JavaScript/PHP )and what not) from the single source code (See www.haxe.org)

  24. ARaybould

    Dr. Pangloss

    "...because it is Dr S, and because there is a slight, defensive hint of Dr P-for-Pangloss about him..."

    I have noticed this too: he manages to explain any aspect of C++ as exactly what you want, or at least the only sensible option. While reading 'The Design and Evolution of C++', I realized how he does this: at the start, he outlines a number of goals that are each worthy, but which are, in many cases, mutually antagonistic. He is then able to pick a subset of those goals to justify almost any aspect of the language.

    I sometimes wonder if a simpler, yet equally capable language could be achieved if one or more of these goals could be dropped, and I think the best candidate would be the 'superset of C' one, though I understand the reason for it.

    While C++ can be frustrating, there are many cases where it is the best choice. It is also a language, like Smalltalk, Lisp and its variants, assemblers, and C itself, that can teach you a lot about programming in general. C++ and Objective-C came along at about the same time, and the latter was sometimes described as 'more object-oriented', so I sometimes wondered if it was a better choice, until I actually got to use it...

This topic is closed for new posts.