Kevin,

A fair assessment of C++ overall, except for that bit:

On Tue, Sep 28, 2010 at 6:17 AM, Kevin Wright <kev.lee.wri...@gmail.com>wrote:

> Object allocation in Java is essentially free.  In C++, malloc is
> expensive.


I don't recall malloc() (or new) ever even showing up in profiling traces.
Ever.

The main problem with malloc, and one that dwarfs any other concern you
might have, is that you need to deallocate memory you allocate yourself,
whether it's with new or malloc. auto_ptr helps to a certain extent, but you
still need to be mindful of this problem. Allocating on the stack is also a
very powerful idiom that will let you avoid this problem whenever it's an
option for you (it also allows for the neat "allocation is initialization"
design pattern, similar to C#'s "using" and hopefully coming to a JDK near
us soon).

As for the original question, I find myself several times more productive in
Java than C++. It's not even close. The main reason is that you spend a lot
more time fighting with the compiler and C++ syntax than in Java, but I can
also list a few additional reasons.

For what it's worth, I used to be a rabid C++ fan and I was even part of the
C++ committee for a few years in the 90's, but the advent of Java made me
realize how far down the rabbit hole C++ had already gone and I hadn't even
noticed (insert "frog in boiling water" metaphor here).

-- 
Cédric

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javapo...@googlegroups.com.
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to