This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Exception Catching.
- To: <gcc at gcc dot gnu dot org>
- Subject: Exception Catching.
- From: "Andy Hanson" <andrew_g_hanson at yahoo dot com>
- Date: Thu, 8 Jun 2000 10:20:50 -0500
Does any version of GCC catch exceptions on things like this.
void test_func(void)
{
long *val=NULL;
((long *)val)[0]=0xdeadcafe;
}
int main(void)
{
try
{
test_func();
}
catch(...)
{
printf("error occured\n");
return 1;
}
printf("worked ok\n");
return 0;
}
I'm still used to the VC++ compiler suite which allows me to catch memory
violations like this. Under linux gcc (egcs-2.91.66 19990314/Linux
(egcs-1.1.2 release)) I just get a segmentation fault.
Is there another way to trap such a violation using gcc (under unix
platforms)?
Thanks in advance.
Andy
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com