Is reading from unallocated memory safe?

Is reading from a random address safe? I know what is written undefined, but what about reading?

Well, in many visual debuggers I can see the contents of memory at an arbitrary address. How it's done?

+4
source share
2 answers

Because the behavior is undefined, the answer is undefined - or at least unstable.

If you are lucky and the random address is within the memory of your program, it would be nice to read most likely, d just get random garbage.

( 0x0/NULL), , segmentation fault ( ), - "", , .

+5

, . , , , , IO, . , , .

, , segfault . , , .., .

, , , , . , , .

+3

All Articles