Well, here we are. Another suggested practice that my C ++ book expresses its opinion on. It says that the return value function (non-void) should not accept reference types as a parameter. "Thus, basically, if you were to implement such a function:
int read_file(int& into){
...
}
and used the integer return value as some kind of error indicator (ignoring the fact that we have exceptions), then this function will be poorly written, and it should look like
void read_file(int& into, int& error){
}
Now for me the first of them is much more understandable and pleasant to use. If you want to ignore the meaning of the error, you do it with ease. But this book offers later. Note that this book does not say that function return values are bad. This rather suggests that you should either return a value or use only links.
What do you think about this? Is my book full of crap? (again)
Earlz source
share