Re: Issue 5310: find_top_context () maintenance (issue 341150043 by nine.fierce.ballads@gmail.com)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5310: find_top_context () maintenance (issue 341150043 by nine.fierce.ballads@gmail.com)

nine.fierce.ballads
Coming back to this after a long time...

I intend to abandon the pointer/reference changes and submit a new
review covering just the second point: "Call find_top_context () rather
than get_global_context () where the
   caller uses the result as a mere Context."

Those interested in the pointer/reference issue can find some discussion
in the C++ Core Guidelines maintained by Stroustrup and Sutter:

     F.60: Prefer T* over T& when “no argument” is a valid option

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-ptr-ref

     F.44: Return a T& when copy is undesirable and “returning no object”
isn’t needed

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-return-ref

There is also a related "Guidelines Support Library" that provides a
not_null<> wrapper that limits the use of pointers that are expected not
to be null.  It is licensed under the MIT license and assumes C++14
support.


https://codereview.appspot.com/341150043/