Pure virtual functions in C++11

前端 未结 8 2243
太阳男子
太阳男子 2020-12-29 18:46

In C++98, the null pointer was represented by the literal 0 (or in fact any constant expression whose value was zero). In C++11, we prefer nullptr

8条回答
  •  不知归路
    2020-12-29 19:43

    Because the syntax says 0, not expression or some other non-terminal matching nullptr.

    For all the time only 0 has worked. Even 0L would be ill-formed because it does not match the syntax.

    Edit

    Clang allows = 0x0, = 0b0 and = 00 (31.12.2013). That is incorrect and should be fixed in the compiler, of course.

提交回复
热议问题