Quote:
Originally Posted by adios
What is the other 65% of the reason you avoid Java consist of?
C++ allows more freedom:
1) free floating functions. If 50% source can be written in functions, I don't like Java forcing me to write classes and create objects everywhere.
2) Pass either by value or reference, e.g.
Code:
void f(int& x, int& y) // modify x and y
is impossible to do in java without creating a class.
3) Operator overloading
4) friend keyword
I haven't done extensive speed benchmarks between Java and C++, however, there's good reason to believe C++ should be faster than Java for several reasons:
1) C++ allows stack allocation of objects
2) C++ runs directly on hardware allowing for cache hits
3) C++ doesn't have a garbage collector, rather memory handled by RAII, e.g. smart pointers.
4) Template specialization to optimize special cases
5) Compile-time evaluations in some cases
6) Data structures aren't immediately initialized unless you say so
7) No bounds checking
Last edited by :::grimReaper:::; 11-27-2015 at 09:22 PM.