Redefining NULL

前端 未结 7 1604
北恋
北恋 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:36

    You're asking for trouble. Redefining NULL to a non-null value will break this code:

       if (myPointer)
       {
          // myPointer is not null
          ...
       }
    

提交回复
热议问题