About structs and performant handling
Namespace
rswhite4 at googlemail.com
Tue Mar 12 11:22:36 PDT 2013
> To repeat myself :
>
> The caller is free to call the ref version of the function
> unless
> (rules evaluate in order) :
> - The argument is an rvalue (in such case, no postblit is
> executed as well).
> - The argument is shared.
> - The argument's postblit in not pure (weakly).
>
> The callee must create a local copy if (this is not verbatim
> from previous post as it has limitations as been pointed
> pointed) :
> - Mutate the struct or anything that *may* alias/be
> transitively reached through the struct.
> - Pass by ref/address taken to a non const/non weakly pure
> function (including method call) of the struct or anything that
> *may* alias/be transitively reached through the struct.
>
> It does guarantee that visible result will be the same.
Because I do not understand everything (due to my bad English) I
would be glad to see one or maybe more examples where the
compiler (according to your rules) change pass by value into pass
by reference, and where not.
And the problem remains that we have to get the attention of
Walter or Andrei.
More information about the Digitalmars-d
mailing list