Why use static_cast(x) instead of (int)x?

前端 未结 9 1768
滥情空心
滥情空心 2020-11-22 02:38

I\'ve heard that the static_cast function should be preferred to C-style or simple function-style casting. Is this true? Why?

9条回答
  •  遇见更好的自我
    2020-11-22 02:53

    One pragmatic tip: you can search easily for the static_cast keyword in your source code if you plan to tidy up the project.

提交回复
热议问题