Quote:
Originally Posted by Jon Stratis
Java, by default, uses Pass by Reference (although you can easily make a new object to make it work the same as Pass by Value), while C++ uses Pass by value (Although with pointers C++ can do Pass by Reference).
|
It's time for me to be the pedantic guy: Java uses pass by value for primitive types and by reference for all others. This is not merely a default: it cannot be changed (The ugly work-around of the caller copying arguments does work, of course). Also, for passing references in C++, I recommend:
the language feature called "references"
On a different note, it's interesting to hear that the Java and C++ WPIlib impelemtations are equally buggy. I had assumed that the C++ one must be worse because the code looks like it was written by someone who wanted to be writing Java.