About ref used for performance reasons with struct
deadalnix
deadalnix at gmail.com
Mon Feb 11 07:12:06 PST 2013
On Monday, 11 February 2013 at 14:54:48 UTC, kinke wrote:
> I'd propose a small change so that suited structs are passed
> transparently byref only if the parameter is not mutable, e.g.,
> for a function foo(const BigStruct s). The compiler would
> therefore not need to analyze the code flow in the callee to
> determine if the parameter is modified and hence a copy is
> needed.
>
That is overly restrictive. See sample code given in this thread,
foo couldn't get the struct by ref in such a case if A contains
any indirection.
More information about the Digitalmars-d
mailing list