J
Jim West
Both
int a;
std::complex<float> b;
std::complex<float> c = static_cast<float>(a)*b;
and
int a;
std::complex<float> b;
std::complex<float> c = float(a)*b;
compile to exactly the same assembler on two different compilers.
However, I always seem to miss the subtleties of the language. Is
one version to be preferred over the other? I tend to use the latter
since it is more compact, which based on my track record is probably
the wrong way to go.
Stylistic suggestions greatly appreciated.
int a;
std::complex<float> b;
std::complex<float> c = static_cast<float>(a)*b;
and
int a;
std::complex<float> b;
std::complex<float> c = float(a)*b;
compile to exactly the same assembler on two different compilers.
However, I always seem to miss the subtleties of the language. Is
one version to be preferred over the other? I tend to use the latter
since it is more compact, which based on my track record is probably
the wrong way to go.
Stylistic suggestions greatly appreciated.