In the Google C ++ Style Guide , he said:
When defining a function, the order of parameters: inputs, then outputs.
Basically, Google suggests arranging parameter settings, for example:
void foo(const Foo& input1, const Foo& input2, Foo* output);
However, my colleague suggested that the conclusion should be put in the first position. because in this way foo can take default values, and most of the time will not use the default value. eg:
void foo(Foo* output, const Foo& input1, const Foo& input2 = default);
I think he said it makes sense. Or is there something that we lack here in terms of readability, performance, ...? Why does the style guide suggest that the conclusion should be the last?
source
share