-
-
Notifications
You must be signed in to change notification settings - Fork 884
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
Undefined behaviour in range-assign #438
Comments
I think I'll rename the basic |
I introduce new functions to disambiguate the calls you mentioned. In particular: Let me know if this is the expected result. Ambiguity on |
I updated my example ( It would probably be enough to ensure that |
After seeing the latest change, I'm convinced that this issue has been thoroughly resolved. The API is much clearer and easier to understand. Simply renaming some functions has had a huge impact. This is really great! You can close this when the changes are merged. |
Yup. I agree. Good suggestions are good suggestions, no doubts about it. 😉 |
I was reading through the code stumbled upon range-assign at 642 and 661.
I was initially confused by the difference between these functions until I found the relevant unit test. It seems easy to mess these functions up. For example:
Can you guess what the output of this program is?
I don't really know how
3
is being turned into5.0f
. If you try some different numbers you get some interesting output. Assigning1
results in3 0
.Maybe that example is a bit contrived (I'm not really using the function as intended and primitive types are rarely used as components) but the fact that it's even possible to do this without any assertions or compiler errors is a hole in the API.
The text was updated successfully, but these errors were encountered: