kapoisu commented on PR #46017:
URL: https://github.com/apache/arrow/pull/46017#issuecomment-3027049211

   > @kapoisu since you have touched `encryption.h|cc` recently, please have a 
look if my changes respect your code style introduced in #46202.
   
   I generally tend to return by value for getters to be safe. It reduces the 
possibility of the object being modified externally and ensures the return 
value won't dangle even if the original object doesn't outlive it. That said, 
if the return value is large and the getter is called frequently, returning a 
reference may be reasonable. Either way, this is just a small trade-off that 
depends on the use cases.
   
   Defining no_key_ as ```const``` unnecessarily prevents the object from being 
copy-assigned. If the object doesn't allocate heap memory, I usually just 
return an empty instance instead, or make it ```constexpr static```.
   
   Other than that, LGTM — thank you for your hard work! :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to