int(floatvar)和(int)floatvar之间有区别吗?

bas*_*ibe 0 c++ language-features typecast-operator

可能重复:
C++:函数(myVar)和(函数)myVar有什么区别?

我已经看到并使用了这些类型转换的两种变体:

int(floatvar)

(int)floatvar
Run Code Online (Sandbox Code Playgroud)

这两者有什么区别吗?关于何时使用哪个有什么偏好?

Nav*_*een 9

它们之间没有区别. (int)floatvar是C语言的方式,int(floatvar)使用C++方式(尽管明确和使用更好static_cast<>).