Compiler says cast then when done says no can do

Mike James null at erehwon.com
Wed May 21 06:24:19 PDT 2008


Ty Tower Wrote:

> I have this line
> 
> double balance=values[6]-values[5]; (values 5&6 are char[])
> 
> so I change to 
> double balance=-(double)values[6]-(double)values[5]; 
> compiler says : C style cast illegal, use cast(double)values[6]
> 
> so I change to 
> double balance=cast(double)values[6]-cast(double)values[5]; 
> compiler says: Error: e2ir: cannot cast from char[] to double
> 
> So as I see it the compiler message in this case at least is wrong or there is a problem casting from a char array to a double . Is it a problem with the compiler message?
> 
> 

I've just tried it - no problems. My compiler version is 1.29.

Maybe try cast(double)(values[5]).



More information about the Digitalmars-d-learn mailing list