0xDEADBEEF equivalent for 64-bit development?

前端 未结 12 573
栀梦
栀梦 2021-02-02 06:46

For C++ development for 32-bit systems (be it Linux, Mac OS or Windows, PowerPC or x86) I have initialised pointers that would otherwise be undefined (e.g. they can not immedi

12条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 06:59

    Generally it doesn't matter exactly what pattern you write, it matters that you can identify the pattern in order to determine where problems are occurring. It just so happens that in the Linux kernel these are often chosen so that they can be trapped if the addresses are dereferenced.

    Have a look in the Linux kernel at include/linux/poison.h. This file contains different poison values for many different kernel subsystems. There is no one poison value that is appropriate.

    Also, you might check per-architecture include files in the Linux kernel source tree for info on what is used on specific architectures.

提交回复
热议问题