normally an array is passed by reference meaning, that if I change the array in the function, the original array is changed. However, if I call the function within std::wcout, the original array stays untouched, however, std::wcout shows the right calculation. Can somebody explain this to me please?
And the output was:
1 2.12 3.0 -3.0 9.87 9.99 0.01 0.2, 0.3 -0.3 0.4 1.0
However, when I change it and display it in 2 seperate std::wcout calls, then the values are changed and sorted.....
It was just unexpected, that the output is correct and the values afterwards are still the original ones....well I don't understand the behaviour but at least it is changed after the call...
I would have thought that GetArgs() would have to be called before GetMoreArgs(), since FindSomeObject gets called first, hence its arguments need to be evaluated first.
Actually I can see how it might not happen that way, I guess the compiler could evaluate the functions in the reverse order, storing the results and then evaluating FindSomeObject and FindASubObject in that order. Sorry to have doubted you ne555!
After some googling, I think the behaviour is well defined, it must be evaluated from left to right. There is a sequence point after evaluating the function arguments, but before evaluating the function body. Hence in my example, GetArgs() must be called before FindSomeObject(), and as a result before GetMoreArgs().
EDIT:
Hmmm, a simple example does not back this up. Maybe you should disregard what I just said.
After some googling, I think the behaviour is well defined, it must be evaluated from left to right.
While the order of the function calls is well defined, the order of the evaluation of the expressions supplied as arguments for those functions are unspecified. The only thing that's required of them is that they're sequenced before the function call they are arguments to.