Access Vialotation
Qian Xu
quian.xu at stud.tu-ilmenau.de
Fri Feb 27 06:01:42 PST 2009
Hi All,
Is there any way to keep program alive, when an AV takes place?
-- demo -------------------------------
module NullPointerExceptionTest;
class Foo {
void bar() {}
}
void main() {
Foo foo; // foo is still NULL
try {
foo.bar(); // A NullPointerException will be thrown
}
catch (Exception E) {
// Can I catch this NullPointerException?
}
}
----------------------------------------
The program will crash, when the line "foo.bar()" is executed, even when a
try-catch-block is added. So far as I know, Java and Delphi can prevent
such kind of crashes from happening with a try-catch-block. Is it possible
in D?
Best regards
--Qian
More information about the Digitalmars-d-learn
mailing list