Does Standard define null pointer constant to have all bits set to zero?

前端 未结 4 768
北恋
北恋 2020-12-07 05:27

( I\'m quoting ISO/IEC 9899:201x )

Here we see that, integer constant expression has an integer type:

6.6 Constant expressions

6. An in

4条回答
  •  猫巷女王i
    2020-12-07 05:36

    Does Standard define null pointer constant to have all bits set to zero?

    No, it doesn't. No paragraph of the C Standard impose such a requirement.

    void *p = 0;
    

    p for example is a null pointer, but the Standard does not require that the object p must have all bit set.

    For information the c-faq website mentions some systems with non-zero null pointer representations here: http://c-faq.com/null/machexamp.html

提交回复
热议问题