the cast mess
Tomas Lindquist Olsen
tomas.l.olsen at gmail.com
Mon May 18 02:10:44 PDT 2009
On Mon, May 18, 2009 at 10:28 AM, Tim Matthews <tim.matthews7 at gmail.com> wrote:
> Having a float -5.7 magically turn into -5 is usually what is wanted for a
> float to int conversion. I am not sure if anyone would want it to be
> converted to -1061788058 instead but dmd currently allows both by having the
> normal way easiest to do and having the unusuall way achievable by placing
> it in an array or struct for the cast.
>
> I am not sure whether I like the inconstistency but is there a use case for
> when -5.7 should ever be -1061788058?
>
> When such invalid casts like "auto aa = cast(A[])fa;" are visible at compile
> time why doesn't all the error throwing happen at compile time?
>
cast(T) is also very poorly documented.
More information about the Digitalmars-d
mailing list