On Wed, Feb 11, 2009 at 8:19 AM, Christopher Wright <dhase...@gmail.com> wrote: > Bartosz Milewski wrote: >> >> What bothers me is that this is equivalent to saying that a seg fault >> caused by null dereference can be caught only if the programmer puts >> explicit runtime checks before it happens. I would say that reaks of C >> philosophy, except that in most C++ implementation I've been working with >> you can simply catch a seg fault. I wouldn't mind not being able to catch a >> seg fault in a language where it's impossible to have an unitialized >> reference. But both in Java and in D it's very easy to get into this >> situation (in fact, it's easier in D) because of hidden reference semantics >> of class objects. Which ties nicely with the discussion of nullable types. > > That is annoying, and there are libraries that fix it. It's already handled > on Windows by default; why isn't it handled on Linux?
Probably because on Windows, segfaults are reported through the same exception handling mechanism that the D compiler makes use of, while on linux, they come in through signal handlers. I don't know how easy it is to start unwinding (or completely unwind) the call stack in the signal handler but the impression I get is that it's not fun.