Evan Stade
unread,Apr 23, 2025, 9:27:12 PM4/23/25Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chromium-dev, K. Moon, Chromium-dev, Evan Stade
> Do you have an example of a worthwhile usage
What do you think of the two examples in my last email? I think they are worthwhile, but they fall outside the bounds of the style guide. None of the four exceptions apply in either case, AFAICT.
>
that allows the caller to pass by value or move. Rvalue references remove that choice from the caller.
I think the intention usually is exactly that --- to influence the caller's usage --- in cases where the callee is opinionated about how it should be used. It is useful to prevent callers from accidentally and silently doing the wrong thing. When there is no good reason to pass by value, it can be assumed that doing so is a mistake and not a choice --- see the ReleaseSoon example. But it actually doesn't remove the choice completely, as callers could still pass a temporary if they really want to make a copy. (i.e. `PassFoo(std::vector<char>(buffer))`)`
>
it's just a limited set of allowed uses
Right --- my suggestion would not be to remove the guidance altogether, but to consider expanding the set of allowed uses to, say, "types that are copiable for the sake of other use cases but in this case really should be discouraged from being copied".
If this suggestion is not a good one, then the fallback purpose of this thread is to raise awareness that rvalue reference misuse is rampant in Chromium.