Why & what to program with C++

There are many, many programming languages, each with their own target audiences and purposes. What about C++? Why program with C++? What type of programs or uses are good for C++ and what type are not?
I would also like to know common examples of C++ implementations, and how C++ is used with other languages.

I am pretty new to C++ (and cplusplus), so if you don't mind me asking another question: How portable is C++?
c++ is a very strong multi purpose language it can be used to create almost every type of programs such as system programs, operating systems and applications. About portability c++ is not OS dependant.
StevenChartis wrote:
Why program with C++?

Because it offers modern high level abstractions while sticking relatively close to the hardware. This allows for an efficient program that can also be modular and very readable (assuming it was written well).

StevenChartis wrote:
What type of programs or uses are good for C++ and what type are not?

It's used a lot in the finance industry, anything that requires intensive rendering, large scale simulations, and down user level applications as well. It's used everywhere. With its strength though, comes development time. It can take quite a bit longer to develop solid, efficient, and relatively bug-free software in C++. It has its annoying quirks. And if the application doesn't necessarily need the speed that C++ offers, then there are better suited languages. That's not to say that there's really anything C++ can't do. But this be said about almost any major language.

StevenChartis wrote:
I would also like to know common examples of C++ implementations, and how C++ is used with other languages.

Not sure what you mean by "common examples of C++ implementations". If you mean examples of software that use it, then this article has a list of some: http://www.stroustrup.com/applications.html (Bjarne Strousup being the creator of C++).
As for the second part, you can have scripting languages that tie into a C++ program. Pretty much any major game studio does this with their games.

StevenChartis wrote:
How portable is C++?

If you want a program to run on different operating systems and/or different processor families, you will need to recompile for each platform. If you used any OS specific code (Win32, POSIX, etc) then it'll take some rewriting. You can't compile Win32 code on a *nix system and vice versa.
This is just a consequence of the language being low-ish level. The counter example language is always Java here. Java's motto is "Compile once, run anywhere." This is because Java programs are compiled down to bytecode which is then interpreted by a JVM (Java Virtual Machine). So any machine that has the JVM installed, can run Java code that was compiled on any other machine.
Last edited on
What type of programs or uses are good for C++

The way I see it, the main niches of C++ are:
1) resource-constrained programming, especially with hard real-time requirements
e.g., generate a signal on a wire in respond to a signal on another wire in under 50 microseconds while juggling hundreds of threads doing different things, or the airplane will crash.. or the missile will miss the target, or the call will be dropped, you name it. C++ is good at this because it supports (and became inseparable from) deterministic resource management

2) software infrastructure
- this involves the core libraries, virtual machines, and other stuff that forms reusable components on which application software depends upon. C++ is good at that because its abstractions come at (almost or completely) no runtime cost.

3) high-performance programming
Because it provides unmatched opportunities for optimization and control of system-level resources.

and what type are not?
The opposites of the above:
1) batch processing, user interaction, and other software that has no realtime requirements
2) non-performance critical code (and even if performance is important, it may be cheaper to buy new hardware than use C++.. C++ comes in handy when you already own the fastest hardware made, and so do your competitors)
3) code that's not intended to be reusable or reliable: prototyping, scripting, etc
Hi again, thanks for the quick and thorough replies.

@ResidentBiscuit: Yeah, my question was pretty vague "I would like... implementations". It was going for a more abstract answer i.e. types of applications, but your link answered that for me.

You guys much answered my questions... for now. Thanks!
Topic archived. No new replies allowed.