-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
remove @ptrCast. add @elemCast #1106
Comments
I will work on this one if you don't mind. |
How would we handle:
|
I'm leaving this up here and will update with further work, will close if the proposal is significantly changed/not approved. |
@alexnask What? I mean the use-cases that the current
|
Right, I was saying those cases do not work without @ptrCast, since you can't "just" cast from one of those types to another, I'm not disagreeing :) |
To get from To get from
maybe |
I guess that could be Edit: Wait no. If you got a |
Discarding attributes is a very unsafe operations. You can easily discard attributes you don't want to discard with
|
Re-opening for reconsideration in light of two new developments:
|
It would be nice if you didn't need two casts for that. |
Right now,
@ptrCast
can change the pointer element, but it gives a compile error if you try to change the alignment or const-ness. We already have@alignCast
to change the alignment only. Really, this cast is only meant to change the underlying element. So let's make that explicit by having the built-in function only accept the child element type as a parameter, and then it's obvious that the other pointer attributes are unmodified.The text was updated successfully, but these errors were encountered: