Do I have to cast double to cdouble everywhere?

bearophile bearophileHUGS at lycos.com
Fri Aug 6 06:54:34 PDT 2010


John Travers:
>     c1 = cast(cdouble)2.0;

Casts are bad, better to avoid them when possible.
You can do this:

void main() {
  cdouble c1;
  c1 = 2.0 + 0i;
}

But complex numbers will be removed from D, they will become partially library ones (imaginary ones will probably just removed). I think they will hopefully keep the same good enough syntax.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list