digitalmars.D.bugs - cast + aritmetic expr bug
- Andrew Fedoniouk (8/8) Feb 11 2005 Following line:
- Unknown W. Brackets (5/20) Feb 12 2005 Does it work properly if you use:
- Andrew Fedoniouk (5/24) Feb 12 2005 This way:
- Derek (12/25) Feb 12 2005 Just move the parenthesis...
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;
Feb 11 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;
Feb 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;
Feb 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
Feb 12 2005