Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align on parameter passing style #54

Open
westonpace opened this issue Apr 27, 2023 · 0 comments
Open

Align on parameter passing style #54

westonpace opened this issue Apr 27, 2023 · 0 comments

Comments

@westonpace
Copy link
Member

The rules we use in Arrow are:

  • If a copy of the variable will never be made then pass const T& if the object is deep and T if the object is shallow (note, I find this deep/shallow thing annoying because things that start out shallow can become deep, so I'm open to improvement)
  • If a copy of the variable might be made (or will always be made) then pass T to allow the caller to std::move and avoid the copy
  • If the variable itself needs to be modified (e.g. an out parameter) then pass T*. This is different than the google C++ style guide which prefers T&. In Arrow, T* is preferred because it makes it obvious the value is being modified at the call site.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant