int64_t a = 1234;
double d = (double) a;
Is this the recommended way?
use static_cast
as strager answers. I recommend against using the implicit cast (or even a C-style cast in C++ source code) for a few reasons:
static_cast
makes your intent immediately obvious.static_cast
and the other C++-style casts are easy for grep
to handle.