Where should be parameters used for output located in the function parameters list
c, c++, coding-style
Solution
Just my personal opinion, but if it reflects copy or assignment semantics, then I prefer to put them to the beginning, just like string and certain stdio functions in the C standard library do:
strcpy(dest, src);
looks like
dest = src;
and
fgets(buf, sizeof(buf), file);
looks like
buf = contents_of(file);
If, however, for some reason this is not the case, then I like to organize things so that input comes first, then output, so then I put output arguments at the end of the argument list.
Problem
I am trying to decide on a policy regarding the usage of function parameters for output in our C/C++ code. It is clear to me that the policy should indicate that all parameters used for output should be grouped together either at the end or start of the function parameter list, but I am not sure there are any good reason to prefer either of these locations. Do you know of any reason to prefer grouping them at the start or at the end?