Conclusion
l C++ forces user to take care of
– Optimization hints (inline, virtual)
– Memory allocation
l Price to pay is:
– crashes, dangling pointers, endless debugging
– Memory leaks – objects that are never deleted
– Corruption of clean OO style because of need for objects
to co-operate on object ownership/destruction
l Java VM’s do an increasingly good job of:
– Memory allocation
– Code optimization
l Without programmer having to worry about it
l In a totally safe (crash resistant) way
45