A comparison between C++ and D
maik klein via Digitalmars-d
digitalmars-d at puremagic.com
Tue Mar 8 20:37:47 PST 2016
On Wednesday, 9 March 2016 at 04:15:39 UTC, Walter Bright wrote:
> On 3/8/2016 6:14 PM, Chris Wright wrote:
>> D does not let you downcast without a runtime check.
>
> You can by casting to void* first, then the downcast.
Thanks I'll update the post later. Does this mean I could do any
cast at compile time?
In encountered the problem here to give some context
https://stackoverflow.com/questions/35694701/is-it-possible-to-cast-foo-to-ubytesize-at-compile-time
Basically I wanted to cast some T to ubyte[size] at compile time.
It seems that casting to void* is not a problem, but then
upcasting from void* to ubyte[size] is still not allowed at
compile time.
If that is not possible maybe I can just use a union instead.
More information about the Digitalmars-d
mailing list