Tags

links:
http://stackoverflow.com/questions/7058339/c-when-to-use-references-vs-pointers

summary:
– reference whenever possible, pointer if a must
– using a pointer as attribute suggests that you can pass nullptr as the argument and it is fine for the function
– using a reference as parameter suggests your function can’t take or check for null pointer
– other option: use pointer for out and in/out params so must dereference them before passing them in

Advertisements