the cast mess

Tim Matthews tim.matthews7 at gmail.com
Mon May 18 01:28:01 PDT 2009


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?



More information about the Digitalmars-d mailing list