[SDL] 0xDEADBEEF ???
prefect_ at gmx.net
Wed Aug 28 15:58:01 PDT 2002
On Thursday 29 August 2002 00:47, Neil Bradley wrote:
> > * 0xCFCFCFCF and 0xDFDFDFDF are pretty high in system memory, so
> > dereferencing them is likely to cause a SigSegV.
> There's no guarantee that your selector is going to base anything at
> 0x000. 0xcfcfcfcf may not be 3GB away. It boggles the mind why anyone
> would want to do anything that could even have a remote possibility of
> being valid when the NULL approach is infallible. Plus, some
> OSes/environments allocate data and code separately - some together, and
> some are initialized to default differently as well. Working off
> non-known state data is a BAD thing.
Exactly. That's why those easy-to-spot byte codes are used _to prevent use
of uninitialized data_. It really _does_ work if you're using a graphical
debugger with watches and stuff.
And it's not only about pointers anyway. It could be integers, floats,
strings, anything you can put into malloc()ed memory. Stuff like all CCs or
CFs simply draws attention when you're looking at memory dumps. Plus, it
happens to be an illegal pointer on many platforms. What more do you want?
Of course, valgrinding is even better :)
More information about the SDL