Const ref and rvalues again...
martin
kinke at libero.it
Thu Nov 8 15:33:54 PST 2012
On Thursday, 8 November 2012 at 22:34:03 UTC, Timon Gehr wrote:
> Ambiguous to me and all the interpretations are either wrong or
> irrelevant.
My point is that it may affect performance. If there was no
const, the compiler would need to allocate a dedicated copy of a
literal whenever passing it to a mutable ref parameter unless the
optimizer worked so well it can prove it's not going to be
modified (which I'm sure you'd expect though :D).
> Maybe you should stop trying to show that 'const' is sufficient
> for resolving those issues. The point is that it is not
> _necessary_. It is too strong.
In that case it actually is - who cares if the read-only double
rvalue the function is passed is the result of an implicit cast
(and there's a reason for it being implicit) of the original
argument (int rvalue)?
Anyway, I think we have moved on in this thread, so maybe you
could contribute to trying to settle this rvalue => (const) ref
issue once and for all by commenting my latest proposal.
More information about the Digitalmars-d
mailing list