News for hackers. Stuff that matters.
Re:Rust means never having to close a socket by crantanplum on Tuesday October 07, 2014 @08:44PM (#8424778)
This is definitely outside the scope of my knowledge, but if you dereference a null pointer, won't you get an illegal memory access?

Undefined behavior, at least colloquially, is about dereferencing a pointer to memory that may or may not be accessed and may or may not work/crash-the-program. That's what makes it undefined and an absolute disaster to track down.

I'm pretty sure that if you try to deference memory address zero the OS will bark at you.

Again, it's not my area of expertise, so please correct me if I'm wrong

Re:Rust means never having to close a socket by dbaupp on Tuesday October 07, 2014 @10:57PM (#8425115)
Dereferencing null is not guaranteed to do any particular behaviour; on many systems, getting the machine to actually dereference 0 will give a segfault/illegal memory access, but the compiler optimises assuming this never happens, and so can break a program that accidentally "relies" on it.

e.g.

- http://stackoverflow.com/q/6793262/1256624

- http://blog.llvm.org/2011/05/what-every-c-programmer-should-...