What is the future of C++

Even though C++ ranks really high in terms of language popularity, I wonder if it is an endangered language with the increasing use of Java that's happening around us.

Second, what language do you think could replace C++ in terms of performance?
C++ is not endangered by any language other than itself. C++0x makes C++ considerably more complex to use to its full extent, and this in itself may be enough to steer new programmers away. Consider that a simple value class such as std::pair now ends up with no less than 18 different constructors thanks to r-value references. The good news is that 0x is also fully backwards compatible, so that a new programmer needn't learn any of the 0x extensions in order to use C++ to the extent that it can be used now (prior to 0x).

It's not just the language that determines performance; it is the compiler. A C++ compiler that generates horrible code could run slower than interpreted Java. If we subtract off the compiler and leave just the language constructs themselves, it is hard to imagine any language that could outperform C++ simply because C++ gives you constructs that come very close to mimicking the underlying hardware. For example, ++x; takes advantage of the fact that many processors have a custom instruction to increment a memory location by 1. And the bitshift operators take advantage of the fact that processors have single instructions to bitshift registers and/or memory locations. These C++ constructs are simple enough to allow the compiler to translate the C++ construct directly to the optimized assembler instruction.



So, to dumb it down (because I only know programming and not much about processors), the syntax of C++ takes maxiumum advantage of the way processors work and what they can do.

If that's the case, isn't it possible that another language be made that also uses a syntax to optimize compilation to assembly?

Thirdly, how does Pascals performance compare with C++. After C, I think Pascal is the other language that can be used to make an OS
To your second point, yes. To your third point, standard pascal does not give you the same direct access to the hardware as C/C++.

Second, what language do you think could replace C++ in terms of performance?


Any language that has good support for parallelism.

Writing scalable parallel programs is hard. Theoretically you can do just everything in C++, just as you can do everything in assembly and obtain top-notch performance, but I don't think it would be practical - writing parallel programs in C++ is... well, far from perfect, even with C++0x. Therefore I think, we will see languages that address this problem used more and more often. In some application domains it has already happened: Java almost wiped out C++ from scalable database systems stuff (I mean - core of the database system, not applications), Erlang found its way over C++ in telecommunications.
Last edited on
To your second point, yes. To your third point, standard pascal does not give you the same direct access to the hardware as C/C++.

Hold on. Neither does C or C++. Hardware access comes through library functions.

The reason we are all sitting around programming our own home computers is because of Pascal. Not C. Borland's Turbo Pascal revolutionized the programming market because Pascal is a strongly, statically typed language that compiles far more quickly than C ever could and catches errors that even lint couldn't, using a clean, straightforward syntax and a significantly more organized structure than C ever had.

Pascal was used to create the original Mac OSes. People writing C compilers had to modify the language to interface with Pascal calling conventions on the Mac, not the other way around as it is more common today.

While C was written with the ability to compile an OS in mind, and Pascal wasn't, neither are the same language that they were originally. Both have had significant improvement.

Kernigan's lambastes of Pascal weren't entirely without merit, but they were overdone. Notice how everyone (including C++) is moving towards managed pointers and more strict typing? Remember that Pascal has always had that? Hmm.... perhaps the pundits did brainwash us into believing their premature opinions after all.

But my biggest grief (besides being partial to Pascal) is the comparison of C/C++ (modern stuff) to "standard pascal" (ancient stuff) in order to belittle it. Shame.

To properly answer the question, the Pascal language is designed to make optimizations easier and more significant than is possible in C and C++. That is not to say that C and C++ can't be similarly optimized, only that it is an order of magnitude more difficult. Both ancient and modern Pascal programs compile to very small, very fast systems, something you need to spend some time and effort to accomplish in C++. Notice also that I did not imply that it is impossible to write very poorly optimized Pascal programs, because it certainly is.

Embarcadero's Delphi XE (who bought Borland Delphi, which is an Object Pascal variant) is primarily used for a number of things, including writing systems software (like device drivers and system components) for Windows.

Also, any language that gives you the ability to manipulate machine data directly and access assembly modules, like C, C++, and Pascal, can be used to write an OS.

Beware that you are asking this question on a C++ forum. Most people who frequent here are rabid C++ people, and some even have axes to grind against languages other than C and C++.
Thanks for the heads up Duoas,

I totally agree. Even though i haven't been programming very long - I've kinda formed this belief that Pascal is quite underrated as a language. Even though, I haven't formally learnt the language because of all the C/C++ hype - I do think that Pascal has a clearer and more well-defined structure. It makes more sense, in an intuitive sort of way!
Topic archived. No new replies allowed.