conversion of const reference to value in input parameters #1908
ad8e
started this conversation in
Language design
Replies: 1 comment
-
Yes, that's a correct interpretation. There's already discussion of this at #1830 if you're interested. But you're not finding a design because this isn't an area that has been fully designed out. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
A recent blog post about Carbon's calling convention says that a const ref parameter (const int&) can be invisibly converted to a copy, if it's cheaper.
puts()
, and loading the value again, would make it valid to elide one of the two loads. Otherwise, there would be a difference in semantics between small types (which can be converted to copies) and large types.Converting a const reference to a copy, and being able to assume that reference is to an unchanging object, have the same meaning. So if one is true, the other should be true too.
Beta Was this translation helpful? Give feedback.
All reactions