Good post.... I am a Java developer with almost 10 yrs of experience and I know I often make that mistake even on Job interviews:).... The problem is that people used to Java tend to think more about the intuitive consequence of passing by ref vs value. When a Java dev thinks of passing by reference he's thinking: "I can alter the state of the reference and the changes would be visible globally, including from within the calling context". In other words Java devs think about altering arguments in terms of altering their state as opposed to altering the reference which is just a numeric address to a memory location. People who program in languages lacking object/class-like structures are more aware of the need to use parameters both as arguments and return values, something that is foreigner to Java programmers.
I haven't done any serious C++ programming in years and I have to admit the examples you used to demonstrate your point; ie modifying the value of arguments appears very strange to me now, I obviously did a lot of that when I did C/C++ development but not having done it in such a long time it really does seem like an unusually way of getting return values:)
I haven't done any serious C++ programming in years and I have to admit the examples you used to demonstrate your point; ie modifying the value of arguments appears very strange to me now, I obviously did a lot of that when I did C/C++ development but not having done it in such a long time it really does seem like an unusually way of getting return values:)