Catching Acces Violation/Segmentation Fault

Jarrett Billingsley kb3ctd2 at yahoo.com
Thu May 10 09:05:42 PDT 2007


"Silverling" <este_aqui_ at hotmail.com.remove.underscores> wrote in message 
news:f1sqc4$2jsj$1 at digitalmars.com...
>I am programming a Matrix class to be used like a primitive type 
>(overloaded operators, identity, transpose, the whole shebang) and one of 
>the constructors _may_ cause an Access Violation (or Segmentation Fault, if 
>you prefer the old Linux SIGSEG) if the class's user is foolish. Is there a 
>way to catch this errors?

void main()
{
    try
        *cast(byte*)null = 0;
    catch(Exception e)
        writefln("I caught : ", e);
}

I hope this works on Linux too.  I'm not sure if it will. 




More information about the Digitalmars-d-learn mailing list