On 27/09/2009 03:35, Walter Bright wrote:
Yigal Chripun wrote:
An exception trace is *far* better than a segfault and that does not
require null values.

Seg faults are exceptions, too. You can even catch them (on windows)!

No, segfaults are *NOT* exceptions. the setup you mention is windows only as Andrei said and for *nix is irrelevant. I develop on Unix (solaris) and segfault are a pain to deal with.

furthermore, even *IF* segfaults were transformed in D to exceptions that still doesn't make them proper exceptions because true exceptions are thrown at the place of the error which is not true for segfaults.


T foo() {
  T t;
  ...logic
  if (error) return null;
  return t;
}

now, foo is buried deep in a lib.

user code has:

T t = someLib.foo();
... logic

t.fubar = 4; //segfault t is null

how is it better to segfault in t.fubar as opposed to throw an exception inside foo?




Reply via email to