Christian Brechbühler <c_************@yhaoo.com> wrote in message news:<Ox9pb.67133$ao4.171996@attbi_s51>...
BTW, (int)x is legacy from C; in C++ we prefer int(x).
Still, the first syntax is useful to know so you can understand it
when others use it. It's also the only way to cast to, say, a pointer:
char*(something) won't work, you need (char*) something.
And actually, some people will say that (int)x is legacy from C,
int(x) is legacy from earlier versions of C++, and in modern C++
static_cast<int>(x) is preferred. (Substituting dynamic_cast<>,
const_cast<>, and reinterpret_cast<> as appropriate.) This is one of
those style issues; typically I use the int(x) style casts when it is
clear what the meaning is (double to int for instance) and use the
"ugly" casts when the meaning isn't so clear and for dynamic casts.