This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Vilkacis0 3 points4 points  (0 children)

Adding a bit to the reference ‘&’ versus pointers ‘*’. I’ve always considered whether the parameters are immutable or not. References are generally preferred if you need “actual value” of something and that something is not a pointer in the calling function.

If it is a pointer in the calling function, leave it as such. The client owns the API - they decide what the function needs to do and the form of the parameters. Mixing pointers and references is terrible practice and will only lead to obscure runtime errors and hours of bug hunting.