Segfault (NullPointerException) in Linux

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Mar 18 08:28:53 PDT 2009


On Wed, Mar 18, 2009 at 11:21 AM, Qian Xu <quian.xu at stud.tu-ilmenau.de> wrote:
> Hi All,
>
> again to the topic "Segfault (NullPointerException) in Linux"
>
> Is it really impossible to catch NullPointerException (segfault) using
> try-catch-statement in Linux?

Yeah, it is impossible.

> I can use signal handler to catch it at system level. But my program will
> stop. If it can be captured inside the program. My program will be more
> robust. And I can write my code more flexible.

If you're getting a segfault, your program is broken.  You shouldn't
be catching and handling them anyway.


More information about the Digitalmars-d-learn mailing list