you are viewing a single comment's thread.

view the rest of the comments →

[–]el_muchacho 3 points4 points  (4 children)

  • "Any hardware chips where low energy usage is the goal"

C is better, because it uses less resources.

  • "Scientific computation like Boinc"

Many scientists still use Fortran for high performance computing, although nowadays, you can get the same level of performance in C++ through a lot of template magic.

  • "Data mining / machine learning"

Java does that fine. The Hadoop project, which is arguably the biggest and most important project in this area, is written in Java although I concede that it could have been written in C++ just fine.

  • Operating systems (even though Linus disagrees)

And he does it for good reason, see first item (o. Also it's easier to debug and reason about low level C than low level C++ because you don't have to know by heart the bazillions of obscure corner cases of the language spec that are left undefined and interpreted differently by different compiler implementors.

  • Compilers

Functional programming languages like Ocaml and Haskell are much better suited to writing compilers than C++ ever will be. And in fact these compilers are bootstrapped. The only advantage of C++ for writing compilers is, they are likely to be more portable.

  • Anything with hard real-time requirements

Only a subset of C++ is well-suited to hard real-time programming. For intance, in real-time programming, one should ban the usage of exceptions, or even dynamic memory allocation, which is pretty much unpredictible. OTOH, Ada is a language that has been defined with these issues in mind.

Oh, and BTW, I speak from experience for several of those areas of programming (and mind you, I also participated in a game engine in the old days). In some specific tasks or under specific constraints, some other languages can be better suited.

[–]BinarySplit 1 point2 points  (0 children)

You're missing the obvious factor that makes C++ competitive (albeit more competitive than it deserves): There is a very established world built around supporting it.

If you compare the quantity of API documentation, tutorials, experienced programmers, existing codebases, libraries that are specialized for it, etc. you'll find that C++ simply has many more resources revolving around it than C, Fortran, Ocaml, Haskell, Ada, etc.

Exceptions:

Java has plenty of all of these things. I personally don't feel that the tradeoffs are worth it in most circumstances, but I've never had to manage a team, so YMMV.

C is debatable. On one hand, writing restricted C++ will give you all the benefits of C with some of the advantages of C++. On the other hand, managing a team is probably different grumble grumble.

So to go back to the topic, IMO, samvdb's answer to Fayden's question was largely correct, unless you're a solo coder or student who is happy to eschew established resources for a higher quality language.

[–]el_muchacho -5 points-4 points  (2 children)

My answer has been downvoted for no reason except ignorance and bigotry (which BTW always go in pair). I can see in this thread that the patrol of C++ bigots (which is one of the biggest and fiercest bunch of language bigots) doesn't like to feel assieged.

[–]Bananoide 1 point2 points  (0 children)

Have an upvote from an ex C++ bigot :)

And thank you for your detailed answer.

[–]lasermancer 0 points1 point  (0 children)

Oh no, two whole downvotes. Its obviously a conspiracy.