41

Currently I'm an IT student and I'm wondering what is still important in C++ today, what for is it used? I completed basic C++ course in my university but I can't imagine where can I use my knowledge and in which direction should I go learning C++.

In other words what should I learn to become a successful C++ programmer?

Currently I'm learning Java just because I don't see clearly in which area C++ could be useful today, but I clearly know which kind of work I'll be doing as a Java programmer. But I still hope that C++ isn't dead.

Thomas Owens
  • 85,641
  • 18
  • 207
  • 307
hades
  • 645
  • 1
  • 6
  • 5

3 Answers3

57

The killer feature of C++ is scope-bound resource management, SBRM (more commonly known as "RAII"). It is the only industrial programming language that is built around this concept. In C++, life times of all objects are exactly known, and (well-written) C++ programs guarantee that resources are acquired and released in fully deterministic manner. In comparison, garbage-collected or otherwise managed languages do not provide any such guarantees; in fact objects in those languages may persist after the end of their lifetime.

That is the reason why C++ is used in finance, video games, high-performance embedded and real-time systems, transportation, manufacture, and other industries where determinism and precision are important. There are no alternatives.

Granted, it was used for a lot more tasks than this, and those tasks are being lost to C# and Python and other more suitable languages, but that is not affecting its core niche.

Cubbi
  • 757
40

There are a few markets for C and C++ (to my albeit limited understanding)

  1. Existing code. C and C++ have some of the largest existing codebases around. Code of this size can't simply be thrown out just because the "next hot new language" has come around. C bindings are pretty much the standard of inter-langauge interaction on most platforms, so being able to author (at the very least) wrapper libraries in C or C++ is useful.
  2. High performance applications (e.g. high frequency finance). C and C++ still achieve better overall performance than most other programming languages. Most importantly in C++, one often builds abstractions with compiler-only things like templates, which moves computation from runtime to compile time (making your overall app faster).
  3. (Similar to 2) Low latency applications. Languages which run on e.g. the CLR or the JVM can often be nearly as fast as C++ depending on the application, but one still needs to load the CLR or JVM themselves into memory before your program can execute. If you have hard startup requirements this is important. EDIT FROM COMMENT: For that matter, hard latency requirements of any description are of note here. Languages which run on virtual machines rarely offer hard time limits because running of e.g. garbage collection is not a deterministic process.
  4. Embedded systems. Some embedded systems have the hardware to run e.g. the JVM (Google's Android (Okay, it's not really the JVM, but it's close), RIM's Blackberry) or the CLR (Windows Phone), but most embedded systems don't have the power to run languages which require more runtime support than that required for C or C++ (which is next to no runtime support at all).
  5. Deployment constrained applications. Sometimes requiring installation of the JVM or CLR is massive overkill if your entire program is only a few hundred KB. (E.g. most of the programs I work on must be deployed as a single .EXE file without any kind of installer or anything like that; for this there are no alternatives)
Billy ONeal
  • 8,083
3

C++ is still very useful and by no means dead. If you want to read a serious comparison between some different programming languages check the paper An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl. It's not the most updated but I believe that most things still hold.

sakisk
  • 3,397