Thread overview
cast + aritmetic expr bug
Feb 12, 2005
Andrew Fedoniouk
Feb 12, 2005
Andrew Fedoniouk
Feb 12, 2005
Derek
February 12, 2005
Following line:

writef("Performance = %g\n", cast(double)(n) / (cast(double)(ms1) * 1000.0));

Produces compilation error:

alphablend.d(79): C style cast deprecated, use cast(ms1)(*(1000))

Did I miss something?

Variables declared as:
long ms1; int n;


February 12, 2005
Does it work properly if you use:

writef("Performance = %g\n", cast(double) n / (cast(double) ms1 * 1000.0));

Or similar?  I believe the problem is (n) and (ms1).  You could also use like (n + 0) and (ms1 + 0)...

-[Unknown]


> Following line:
> 
> writef("Performance = %g\n", cast(double)(n) / (cast(double)(ms1) * 1000.0));
> 
> Produces compilation error:
> 
> alphablend.d(79): C style cast deprecated, use cast(ms1)(*(1000))
> 
> Did I miss something?
> 
> Variables declared as:
> long ms1; int n; 
> 
> 
February 12, 2005
This way:

writef("Performance = %g\n", cast(double) n / (cast(double) ms1 * 1000.0));

it works. Thanks.



"Unknown W. Brackets" <unknown@simplemachines.org> wrote in message news:cukdb9$s0o$1@digitaldaemon.com...
> Does it work properly if you use:
>
> writef("Performance = %g\n", cast(double) n / (cast(double) ms1 * 1000.0));
>
> Or similar?  I believe the problem is (n) and (ms1).  You could also use like (n + 0) and (ms1 + 0)...
>
> -[Unknown]
>
>
>> Following line:
>>
>> writef("Performance = %g\n", cast(double)(n) / (cast(double)(ms1) * 1000.0));
>>
>> Produces compilation error:
>>
>> alphablend.d(79): C style cast deprecated, use cast(ms1)(*(1000))
>>
>> Did I miss something?
>>
>> Variables declared as:
>> long ms1; int n;


February 12, 2005
On Fri, 11 Feb 2005 23:48:07 -0800, Andrew Fedoniouk wrote:

> Following line:
> 
> writef("Performance = %g\n", cast(double)(n) / (cast(double)(ms1) * 1000.0));
> 
> Produces compilation error:
> 
> alphablend.d(79): C style cast deprecated, use cast(ms1)(*(1000))
> 
> Did I miss something?
> 
> Variables declared as:
> long ms1; int n;

Just move the parenthesis...

writef("Performance = %g\n", (cast(double)n) / ( (cast(double)ms1) * >
1000.0));

I think that the reason is that the form

  '(' identifier ')'

looks like a C-style cast, as well as looking like a single-term expression. It is because of this ambiguity that C-style casts are deprecated.

-- 
Derek
Melbourne, Australia