Many programming languages can be used to achieve one task, all in different ways. C++ is no exception, it can be used to build almost anything as far as software engineering goes. Like other language, it has advantages and disadvantages.
The mainstream games industry is still using C++ as standard. Mobile development, however, differs depending on the device. For example, Apple iOS applications are written in Obj-C (although you can get C++ wrappers for this) and Android typically favours a Java-based approach.
Aramil of Elixia wrote:
anything blizzard, anything nintendo, the internet (which was actually in c but still) viruses, virus scanners, etc etc
Where did you hear that? The Internet is a system of computer networks, not a program.
C++ most appropriate when you need
1. performance
2. getting close to the machine
Java is considered as fast as C++ now but you don't get 2.
For example if you want to use openGL in Java you have to use an intermediate layer (JOGL) to bridge between the JVM and the graphics hardware. In C++ you just use the openGL C interface directly.
There are plenty of cases where C++ is not the best choice.
Where did you hear that? The Internet is a system of computer networks, not a program.
Maybe he was referring to heavy Unix background of the early Internet.
@OP,
It's used really anywhere where performance is needed. Heavy rendering software, image editing (Photoshop is written in C++), video games, anything computation heavy.
Holy god people. Stop this Java vs C++ crap. They are different languages for different purposes. You don't write a damn OS in Java, and you don't write web applets in C++.
Holy god people. Stop this Java vs C++ crap. They are different languages for different purposes. You don't write a damn OS in Java, and you don't write web applets in C++.
They are both general purpose programming languages. If performance is important for you, then how they perform is relevant to which language you should choose.
I'm sincerely interested in clearing this up so that I may make better decisions myself.
Holy god people. Stop this Java vs C++ crap. They are different languages for different purposes. You don't write a damn OS in Java, and you don't write web applets in C++.
You don't write a Java virtual machine in Java :P. There are still many circumstances where you can use C++ or Java.
They are both general purpose programming languages. If performance is important for you, then how they perform is relevant to which language you should choose.
Yea how you define "general purpose" here really makes a difference. Yea sure, in theory you can probably do most anything with either language. That doesn't mean you should. Let's go back to the old tool analogy. I can definitely hammer some nails with a screwdriver, but why the hell would I do that when there's a perfectly good hammer right there?
C++ if you need performance while keeping high level abstractions. No idea when you would use Java - throwing everything on the heap has its penalties regarding performance, as does leaving the cleanup to a garbage collector. At the same time, Java isn't noticably more high level than C++. I suppose the answer "when use which" would be best answered as "what fits best into the environment (existing code + programmer skills) of your organisation", though for a new project I'd probably go for C++.
I can definitely hammer some nails with a screwdriver, but why the hell would I do that when there's a perfectly good hammer right there?
Except that analogy completely fails when comparing C++ and Java. For most cases, Java's speed tradeoff isn't so bad, and the programmer productivity overhead of C++ isn't really greater than in Java. It's more like, you need a screwdriver, but whether Screwdriver X or Screwdriver Y is better depends on what Screw's you have loose.
So then why should we not talk about which language to use for what?
Because the creator's themselves have said that the languages aren't meant for everything. It's common sense, but some people now believe that if a language can do something, that it should. Java itself doesn't lend itself to anything that has to run for long periods of time. How many servers written in Java do you see out there?
I wrote a program a couple days ago to keep track of my workout progress. It stores data on type of workout, distance, comments, units, date and sorts according to which you prefer. C++ can be used for a ton of small projects to help make your life more efficient, like the example above!
@ResidentBiscuit and iseeplusplus: General Purpose, defined by Google (http://lmgtfy.com/?q=define+general+purpose ) seems to me means that as long as a language is Turing Complete (Almost every programming language). But the OP did not ask if one language can do more, they asked what is C++ more suited for. The answer, like everyone else has said is performance. If you want to code something that will run fast use c/c++ if you want a web applet use java, if you are coding a web page, javascript or php.