C++ When should we prefer to use a two chained static_cast over reinterpret_cast

前端 未结 6 1528
不思量自难忘°
不思量自难忘° 2020-12-04 01:29

First of all, this is not a duplicate of Why do we have reinterpret_cast in C++ when two chained static_cast can do it\'s job?.

I know situations where we cannot use

6条回答
  •  遥遥无期
    2020-12-04 02:19

    Since, the listing of the scenarios can go very long, I am putting in simple words:

    If chained static_cast<>s don't give compile-error, you should avoid reinterpret_cast<>.

提交回复
热议问题