escaping addresses of ref parameters - not

Bartosz Milewski bartosz-nospam at relisoft.com
Mon Feb 9 11:01:12 PST 2009


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.

Christopher Wright Wrote:

> Denis Koroskin wrote:
> > On Mon, 09 Feb 2009 11:24:09 +0300, Bartosz Milewski 
> > <bartosz at relisoft.com> wrote:
> > 
> >> My point is that it's a redundant check. Whether it is there or not, 
> >> the result is the same--the program will halt. Maybe the error message 
> >> form enforce will look nicer, but that's about it.
> >>
> > 
> > It will throw a recoverable Exception (an access violation is an Error, 
> > IIRC).
> 
> And a segfault is a hard stop, unless you have a signal handler for it.




More information about the Digitalmars-d mailing list