This is a follow-up on this question. The code in the OP question there looked quite reasonable and unambiguous to me. Why does not C++ allow using former parameters to define default values of latter parameters, something like this:
int foo( int a, int b = a );
Also, at least in C++11 declared types of parameters can be used to determine the return type, so it's not unheard of to use function parameters in similar manner:
auto bar( int a ) -> decltype( a );
Thus the question: what are the reason(s) why the above declaration of foo
is not allowed?
__cdecl
and__stdcall
) define right-to-left order of argument passing. If you debug code with some non-trival (containing custom constructors) parameters as a function arguments and step-into such call, you will notice, that constructors are indeed being called in reverse order. – Kajdan