On Saturday, 3 September 2016 at 18:06:37 UTC, Dicebot wrote:
On Saturday, 3 September 2016 at 14:40:37 UTC, Martin Nowak wrote:
On Wednesday, 31 August 2016 at 09:56:17 UTC, Johan Engelen wrote:
(I can only think of complicated stuff that requires pretty much whole-program analysis to prove validity, and in that case adding `private` doesn't help any more)

Yes, it does help. As private prevents usage outside of a module it allows to do some optimizations that required whole program analysis otherwise, e.g. variables and functions can get internal linkage, thus reducing loads/stores and indirect calls.

This is a very naive viewpoint.

There are enough ways to leak access to private entity (alias, template argument, taking address, some compile-time introspection) to make such optimizations impossible without extensive program analysis.


Reply via email to