Hello Gophers, 

https://play.golang.com/p/xpuit5lh9hh

An array out of bounds throws panic at runtime. 

How does the internal runtime know that we are accessing the memory which 
we are not allocated? Interested in knowing more depth of the internals. 

This Link <https://go101.org/article/bounds-check-elimination.html> talks 
about the compile time on how the compiler avoids the bound checks. 

But during runtime I am more interested to know what happens when we access 
the invalid memory local through indexing. 

Does the OS return a signal and go runtime converts that into a panic? Any 
links or more reading links are appreciated.

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3daf369e-4f9b-47be-a7ce-86916dc7cd07n%40googlegroups.com.

Reply via email to