Redefining NULL

前端 未结 7 1633
北恋
北恋 2020-11-30 20:53

I\'m writing C code for a system where address 0x0000 is valid and contains port I/O. Therefore, any possible bugs that access a NULL pointer will remain undetected and at t

7条回答
  •  不知归路
    2020-11-30 21:29

    The bit pattern for the null pointer may not be the same as the bit pattern for the integer 0. But the expansion of the NULL macro must be a null pointer constant, that is a constant integer of value 0 which may be casted to (void*).

    To achieve the result you want while staying conformant, you'll have to modify (or perhaps configurate) your tool chain, but it is achievable.

提交回复
热议问题