Date: Wed, 9 Apr 2008 14:48:27 -0400 From: Alexander Kabaev <kabaev@gmail.com> To: yuri@rawbw.com Cc: freebsd-hackers@freebsd.org Subject: Re: C++ exceptions are broken in FreeBSD with gcc-compiled code? Message-ID: <20080409144827.39bc4f33@kan.dnsalias.net> In-Reply-To: <47FCF12D.3070902@rawbw.com> References: <47FCF12D.3070902@rawbw.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/iD9spt9QYGHAIGXlAkRJ/Ob Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 09 Apr 2008 09:39:09 -0700 Yuri <yuri@rawbw.com> wrote: > I am unable to make a C++ program to catch an exception using the the=20 > system g++ compiler. % c++ -o exc exc.c=20 % ./exc Caught an exception "String" % c++ -O2 -pthread -o exc exc.c % ./exc =20 Caught an exception "String" % c++42 -O2 -pthread -o exc exc.c % ./exc Caught an exception "String" % c++42 -O2 -o exc exc.c =20 % ./exc =20 Caught an exception "String" % cat exc.c #include <iostream> #include <string> using namespace std; int main() { try { throw string("String"); } catch (string s) { cout << "Caught an exception \"" << s << "\"\n"; } return 0; } % uname -a FreeBSD kan.dnsalias.net 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Sun Apr 6 14:22:23 EDT 2008 ... Same on RELENG_6 (do not have 7.0 around, but 8.0 and 7.0 are identical compiler-wise. Same on 8.0/amd64. BTW, do you have . in your PATH? > g++ -fexceptions -o exc exc.C > exc <=3D=3D=3D=3D should it be ./exc ?=20 Exception raised: Memory allocation failure! ^^^^^^^^^^^ Not in your sample code. --=20 Alexander Kabaev --Sig_/iD9spt9QYGHAIGXlAkRJ/Ob Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iD8DBQFH/Q97Q6z1jMm+XZYRAks+AKCGBgEyL0NRgNt+KmBI8r/c+jpvDQCbBZGJ ZNrRh6FBUbN4Cq+axMW/BqQ= =JKzo -----END PGP SIGNATURE----- --Sig_/iD9spt9QYGHAIGXlAkRJ/Ob--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080409144827.39bc4f33>