This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Q: Catch a segmentation fault
- To: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
- Subject: Q: Catch a segmentation fault
- From: Roger Wernersson <roger dot wernersson at mindark dot com>
- Date: Thu, 25 Jan 2001 11:40:51 +0100
Hi!
I'm new to this list. I don't know if this question belongs to it but I have
failed to find any information about my problem elsewhere so I turn to you.
We're currently developing code on i386 on both Linux and Windows and one of
the Win32-programmers put in some code to catch segmentation faults. It
works fine on Windows but fails to catch it on Linux.
This is an example.
#include <iostream.h>
int main()
{
char *zero = NULL;
try
{
zero[0] = 'a';
}
catch()
{
std::cout <<"Catch!" <<std::endl;
}
return(0);
}
This gives me a segmentation fault and terminates my application. Can't I
catch this using the GCC C++ compiler?
I can catch a throw(something).
I'm running RedHat 6.2 on a P3 and use egcs-2.91.66.