A
A
Arsen002020-07-05 00:19:59
C++ / C#
Arsen00, 2020-07-05 00:19:59

What happens when you try to access address 0x0 of virtual memory?

There are photos with addresses starting with 0x1000, 0x1008, 0x1010, 0x1018, etc.
What happens when you try to access address 0x0 of virtual memory?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2020-07-05
@Arsen00

In the context of the C++ language, there will be undefined behavior with unpredictable consequences. An optimizing compiler can reorder the execution sequence of a program to assume that a dereferenced pointer in a valid program cannot be 0.
In the context of program behavior, if address 0 is accessed, the behavior is OS/runtime dependent. Options -- SIGSEGV signal (POSIX) will be sent to the program, an exception will occur in the program (windows), access will be performed as to any other address (OS without memory protection).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question