On Monday, 2 March 2015 at 22:21:11 UTC, Zach the Mystic wrote:
On Monday, 2 March 2015 at 22:00:56 UTC, deadalnix wrote:
You don't put the ownership acquire at the same place, but
that is the same idea. It is probably even better to do it
your way (or is it ?).
Yes. Unless the compiler detects that you duplicate a variable
in two parameters in the same call, you literally have *no*
added cycles, anywhere:
fun(c, c.c);
This is the only time you pay any penalty (except for passing
globals, as we now realize, since all globals can alias
themselves as parameters -- nasty).
Global simply are parameter implicitly passed to all function
from a theoretical perspective. There are no reason to thread
them differently.