0xDEADBEEF equivalent for 64-bit development?

前端 未结 12 577
栀梦
栀梦 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条回答
  •  走了就别回头了
    2021-02-02 06:59

    It depends on the OS and the environment, of course. I don't think 0xDEADBEEF is necessarily a bad pointer in an arbitrary 32-bit system, either.

    Realistically, any modern OS should be access-protecting the first few pages of process memory, so NULL should be a good invalid pointer value. Conveniently enough, it's already pre-defined for you.

提交回复
热议问题