Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Feb 1999 20:43:25 -0800
From:      Amancio Hasty <hasty@rah.star-gate.com>
To:        hackers@FreeBSD.ORG
Subject:   gcc 2.8.1 Exceptions?
Message-ID:  <199902220443.UAA88362@rah.star-gate.com>

next in thread | raw e-mail | index | archive | help
Does anyone know what is the magic incatation to make C++ exceptions work 
with gcc-2.8.1 from the ports distribution? .

 Exception handling appears to work with the stock gcc...


 /usr/local/bin/g++  -g -o foox foo.cpp
foo.cpp: In function `void terminate()':
foo.cpp:19: warning: `noreturn' function `terminate()' does return

./foox
Abort (core dumped)

/usr/bin/g++ -g -fhandle-exceptions -o foox foo.cpp
{hasty} ./foox
hello 
hello a 
Exception caught I shot the compiler!

main() {
  int i = 0;
  try {
    i = i + 1;
    if (i > 0 ) throw "I shot the compiler!";
  } catch ( char *p) {
    printf("hello \n");
    printf("hello a \n");
    printf("Exception caught %s\n", p);
  }
}
void terminate() {
printf("hello terminate \n");
} 


	Tnks,
	Amancio




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902220443.UAA88362>