Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Do wild pointers truly point to a random value, or is that just shorthand for some value that will crash the program?

I’ve learned about wild pointers and how to avoid them. I’ve heard that they point to a random value in memory and I was wondering if they actually have a random and completely irrelevant value or if they point to a certain value that’s probably implementation dependent. Which is it?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

These dangling pointers are not random in the "mathematical" sense. They point to an implementation dependent location (based on hardware arch, runtime sequence, etc), that your program isn’t supposed to have access to & the content of the pointed location is undefined from your program’s point of view. The operating system is free to re-allocate & write whatever whenever so your pointer to that memory is deemed "random" in its value.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading