[LC++]exceptions out off class

Julien Patrick Claassen julien at c-lab.de
Mon Jul 15 22:15:06 UTC 2002


Hello!
  I have a general problem. I tried to get my experience with exceptions a
little bit better again. So I wrote a testprogramm. It compiled fine, but
it seg.fualts. Asume thefollowing:
  There's a simple exception-class with a member function getString() and
of course a string itss. Then there is a function test, which just throws
the exception.
  In the main-programm I then try to catch it. If I just catch it like:
catch (my_exception)
it works. But if I catch it like:
catch (my_exception e) OR
catch (my_exception& e)
it segfaults.
  If I throw the exception in main and catch it there, everything works
fine in all three ways.
  Does passing exception by reference or by value only work if you do it
out of a class?
  Kindest regards
       Julien

Julien Patrick Claassen
jclaassen at gmx.de
julien at c-lab.de
http://www.geocities.com/jjs_home

SBS C-LAB
Fuerstenallee 11
33102 Paderborn

Phone: (+49) 5251 60 6060
Fax: (+49) 5251 60 6065

www.c-lab.de





More information about the tuxCPProgramming mailing list