Let\'s say you have a function that modifies a variable.
Should you write it like this: void myfunc(int *a) or like this void myfunc(int &a)>
The former forces you to call the function with myfunc(&b) so the caller is aware that b will be modified
sometimes function could accept const pointer and caller will have wrong thinking that b will be modified.
My recommendation - prefer use references everywhere where it possible (ofcourse where it needed). In case with function argument - we get benefits:
- references can't be NULL - it help us to avoid errors and unnecessary asserts or checks.
- references have only one initialization point and in function boody you always know on what thing input parameter points.
I'm maintainer on large project. And in either cases I'm looking on function definition before call its. Ofcourse when I looking on function definition I see arguments definition by value, by reference, by const reference or by pointer.
But it seems like holy-war question, defferent peoples have different view on this point. E.g. google codding convension recomended use pointers in arguments which could be changed and allowed only const references: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Reference_Arguments
All parameters passed by reference must be labeled const.