-
-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The last (in lexical order) copy of an object must be a move #18995
Labels
Comments
issues.dlang (@jmdavis) commented on 2015-06-01T14:00:03ZSo, basically, you want RVO to be guaranteed to occur rather than it being considered an optimization (and thus being optional)? |
issues.dlang (@jmdavis) commented on 2015-06-01T14:04:44ZOh, wait. No, this is not just RVO. You're not even returning in the example. Clearly, I paid too much attention to the text and not the example. Not enough sleep, I guess... |
issues.dlang (@jmdavis) commented on 2015-06-01T14:13:59ZIt's my understanding (though I could be wrong) that the
void main()
{
fun(S1());
hun(S2());
}
part at least is guaranteed to do a move, since you're dealing with temporaries. I would have expected the rest of it to do moves as well like you're requesting, but I don't remember how guaranteed it's supposed to be. Clearly, the compiler doesn't seem to think that it's guaranteed though, since it's not doing it.
Regardless, I agree with this. We need to make it so that moves are guaranteed where we can for both performance reasons and for noncopyable objects (and the noncopyable objects pretty much throw it in your face when it doesn't do a move).
However, I don't understand what you mean by dynamic and static uses. Is a dynamic use one that may or may not be the last one hit depending on what occurs after it, whereas a static use is guaranteed to be the last use if it's hit? |
andrei (@andralex) commented on 2015-06-01T15:26:07Z(In reply to Jonathan M Davis from comment #3)
> However, I don't understand what you mean by dynamic and static uses. Is a
> dynamic use one that may or may not be the last one hit depending on what
> occurs after it, whereas a static use is guaranteed to be the last use if
> it's hit?
Static is as you read the code in lexical order, dynamic is as it actually gets executed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Andrei Alexandrescu (@andralex) reported this on 2015-06-01T04:31:46Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=14638
CC List
Description
The text was updated successfully, but these errors were encountered: