From kde-devel Fri Jul 30 15:26:06 1999 From: Heiko Nardmann Date: Fri, 30 Jul 1999 15:26:06 +0000 To: kde-devel Subject: slightly off topic: general C++ question X-MARC-Message: https://marc.info/?l=kde-devel&m=93334836505714 Hi! I have a problem with exceptions in that I probably did not really understand the concept, I suppose. I have written the following small test program: ------------------------------------------------------------------- #include #include int main( int argc, char **argv ) { try { throw invalid_argument(string("error")); } catch (...) { } return 0; } ------------------------------------------------------------------- Is there something wrong about it except that it does not do anything useful? Now I compile it with g++ -g -Wall -o test1 test1.cpp This gives me no warnings so I suppose this is ok?! Now executing it with ./test1 results in: Segmentation fault (core dumped) Now I have a look with gdb: gdb ./test1 core which results in: GNU gdb 4.18 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... Core was generated by `./test1'. Program terminated with signal 11, Segmentation fault. Reading symbols from /usr/lib/libstdc++.so.2.9...done. Reading symbols from /lib/libm.so.6...done. Reading symbols from /lib/libc.so.6...done. Reading symbols from /lib/ld-linux.so.2...done. #0 0x4004816b in __is_pointer (p=0x804af53) from /usr/lib/libstdc++.so.2.9 (gdb) where #0 0x4004816b in __is_pointer (p=0x804af53) from /usr/lib/libstdc++.so.2.9 #1 0x40046aa0 in __cp_pop_exception (p=0x804cd78) from /usr/lib/libstdc++.so.2.9 #2 0x8049e69 in main (argc=1, argv=0xbffff444) at test1.cpp:11 Is there anyone out there having an idea what I am doing wrong here? I have a SuSE 6.1 system with the standard egcs-1.1.2 and libstdc++ 2.9 installed. -- Ciao ... Heiko Nardmann (Dipl.-Ing.), h.nardmann@secunet.de, Software Development secunet (www.secunet.de), Security Networks GmbH - Sicherheit in Netzwerken Weidenauer Str. 223-225, D-57076 Siegen Tel. : +49 271 48950-13, Fax : +49 271 48950-50