+ 14
What are C++ features missing in Java?
5 Answers
+ 7
@Denis,
In short, C++ needs the user to free the memory, where java (garbage collector) does it automatically. It is not standard in c++ to perform this automatically.
In C and C++, any memory that is allocated on the heap (e.g. using malloc or new) must be explicitly freed by the programmer (e.g. using free or delete). Forgetting to free memory leads to memory leaks, and in long-running programs can lead to the memory usage of the program growing very large.
Java provides garbage collection, meaning that memory is freed automatically when it is no longer reachable by any references. This prevents memory leaks, but can lead to pauses in execution while the garbage collector runs. Also, there is no promise of timely destruction in Java.
Source: http://www.codemiles.com/java/c-java-memory-management-t473.html
+ 6
Multiple inheritance is a very important aspect of c++ missing in java.
Also java supports automatic memory management, where c++ does not (garbage/class destructors).
+ 2
Billy, smart pointers are standard in c++11 and c++14. The problem is that not all compilers include those standards by default. It will probably be default in a few versions of gcc, for example.
+ 1
Speed.
+ 1
Billy, C++ supports memory management with smart pointers. It is just not standard yet.