Casts without explicit type #4428
Replies: 3 comments 2 replies
-
Can be also called "target-typed explicit cast". |
Beta Was this translation helpful? Give feedback.
-
so basically a language feature to avoid 'no implicit cast exists, an explicit one does, did you miss a cast' error without having to directly name the type? |
Beta Was this translation helpful? Give feedback.
-
I remember having seen a similar proposal where instead of My opinion on this is, Generally, those are the options I see as of now:
Note that |
Beta Was this translation helpful? Give feedback.
-
In situations like this:
You have the field's type two times in your code and it's a little bit unnecessary. It could be easily avoided with syntax like this:
I'm not 100% sure about the syntax, it looks a little bit weird, so it might be a good idea to discuss this and come up with something better.
Alternative solution to this problem is to allow implicit casts for void* to any other pointer type, but this solution is more generic and it's not limited to pointers so it may solve other similar problems too.
Beta Was this translation helpful? Give feedback.
All reactions