
Is C++ still needed? - davidsantoro
http://www.gerd-riesselmann.net/archives/2005/11/is-c-still-needed
======
DanielBMarkham
With all due respect, this guy doesn't know what he's talking about.

There might be a case to be made to eliminate C++, but it's best made by
somebody who knows more than this guy.

This is really a terrible submission.

~~~
mtarnovan
No respect due here. This guy truly doesn't know what he's talking about. "C++
is slow". LOL.

[http://shootout.alioth.debian.org/u32q/benchmark.php?test=al...](http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=gpp&lang2=csharp&box=1#title)

[http://shootout.alioth.debian.org/u32q/benchmark.php?test=al...](http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=gpp&lang2=java&box=1)

~~~
vilya
Reading the article, it sounded like he was comparing the speed of some
unspecified ORM library in each language. If so, I suspect he may have been
comparing a naive hand-rolled implementation in C++ to something like
Hibernate/NHibernate which has many years of development and optimisation
behind it.

The lessons to draw from this, if any, are that C++ code isn't automatically
faster than Java or C# code: you have to make it so; and that Java/C# have
some useful high-quality libraries which save you the need to roll your own
solution.

~~~
tamas
Actually, object creation on the heap can be quite slower in C++ than in Java,
at least if you are not using a custom allocator. The standard allocator in
C++(using malloc) is SLOW.

~~~
Nelson69
The original article was terrible, so normally I wouldn't comment but I'll
attempt to improve the discussion..

Do applications in C++ get modeled the same way as they would in Java or C#?
Allocation speed doesn't quite seem like an apples to apples comparison.

~~~
tamas
If by being modeled you are asking whether objects are used in C++ as in
Java/C#, then I would say yes, maybe even more so. Of course in C++ there is a
possibility to use it as a "C with some more stuff" language, and
unfortunately it is used as such regularly. But well designed C++ code
involves object usage quite similar to Java/C#. Also in C++, RAII is used for
managing transient resources, and this probably introduce extra objects which
in Java would not be created.

For example: Creating a temporary file and after some work deleting it would
be done using try & finally sections in idiomatic Java, but in C++ an object
would be used where the constructor contains the file creation and the
destructor contains the deletion. This way the file lifetime is tied strictly
to the object lifetime, which would be destroyed automatically when the code
block is left.

However, the fact that object allocation on the heap is slow is mitigated by
having the ability to create objects on the stack, which is probably even
faster than Java or C#. And they are also managed automatically, so stack
objects are always preferred if they are suitable.

While I think it is an apple-to-apple comparison, it is a microbenchmark, and
as such probably irrelevant in most of the real-world cases.

------
chanux
"Conclusion? C++ sometimes is the best choice, sometimes not."

Isn't that the case for any programing language?

~~~
dkersten
Well... not "any", theres some I can't really see would ever be the "best"
choice. Lolcode anyone? (I'm sure theres non-joke languages too)

~~~
calcnerd256
obligatory mention of brainf

------
olliesaunders
It's difficult to imagine games being written in Java or C# and being faster
than C++.

~~~
steiger
Some say that Jake 2 ( <http://en.wikipedia.org/wiki/Jake2> ) actually ran
faster than Quake 2. Of course there are a number of points to consider here,
like the oldness of the Quake 2 code (thus a lack of optimization for modern
computers).

Anyway, just a curiosity :)

------
kaitnieks
C++ and Delphi are almost the last of few ones left to generate proper Windows
exe files. DotNET is great for business applications but when you think about
creating mass products, you have to keep returning to C++ and friends.

~~~
ilyak
Factor generates stand alone images.

~~~
nrr
Not only that, but Factor generates application bundles -- not just the binary
-- for OS X when asked to. At least, it did the last time I checked.

------
greyman
I have experience programming in large teams in both C++ (~10 years) and C#
(~3 years), and my feeling is that the overall development is really quicker
in C#. It's a large windows-only standalone app where speed is very important.

But if my team have to build such app with cross-platform requirement, I still
think C++ would be the choice. [with the similar arguments the author uses at
the end of his rant]

~~~
uhgibuig
Or if you need to use any other libraries. C# is great assuming everything you
need is in .Net. As soon as you need a decent maths library or a screengraph
or some image processing it involves a lot more work.

------
nrr
This thing reads like a USENET troll post. No joke.

------
humbledrone
FTA: "C++ isn't open to other languages"

Obviously the author has not heard of boost::python -- it provides an
extremely easy way to interface Python and C++, including classes in one
language that inherit from classes in the other.

EDIT: Oh, yeah, and SWIG.

------
wglb
Often done--a list of what is important in language choice, followed by the
choice we wanted to make anyway: "Nethertheless, we choosed C++ as our
language." C++ is slow, but in time to learn or write, but not necessarily in
execution.

------
ilyak
Nope!

