D - dynamic_cast only?

Vladimir Panteleev vladimir at thecybershadow.net
Sun Dec 25 00:39:01 PST 2011


On Sunday, 25 December 2011 at 08:37:21 UTC, Steve Teale wrote:
> I'll try again on this.
>
> My reading of the current documentation on casts leaves me with 
> the impression that D now has only the equivalent of the C++ 
> dynamic_cast.
>
> This seems unreasonably restrictive given that C++ has 
> traditional C-
> style cast, dynamic_cast, static_cast, and reinterpret_cast - 
> or maybe it's changed now?
>
> If D is a system programming language should I not be able to 
> tell the compiler that a given set of bits represents what I 
> say it is, and suffer the consequences if I get things wrong?

The topic regarding confusion caused by having one cast syntax 
for everything is not new to this group. However, to 
unconditionally cast any reference type to any reference type, 
simply cast to void* first to avoid the runtime check.


More information about the Digitalmars-d mailing list