Friday, March 20, 2009

Answer to pitfall III (I forgot to post this earlier)

The answer is simple. I bet the bells start ringing when I say this. Usually with 32 bit systems, memory address is 32 bit wide. With 64 bit systems it often is 64 bits wide...

...

...Now, look at the pitfall III again, and you'll see that we do pinter arithmetics by handling pointers as integers. This means that half of the address will be cropped, and remaining address is most propably something pointing at invalid locations. After you use it, MMU will detect your process accessing out of the virtual address space mapped for the process. It'll kick up kernel, which most propably decides to send SIGSEGV signal to your program. And if youre writing anything more critical than snake game, you haven't registered handler which forgives SIGSEGV. Eg. result is segmentation fault. Adios. Bye. Game over. Sommoro ja Soronoo.

No comments:

Post a Comment