delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f |
Message-ID: | <3C66CA98.70901@vif.com> |
From: | Sahab Yazdani <sahaby AT vif DOT com> |
Organization: | PheonixSoft Interactive |
User-Agent: | Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.7+) Gecko/20020124 |
X-Accept-Language: | en-us |
MIME-Version: | 1.0 |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | c++ exceptions |
Cache-Post-Path: | www.vif.com!unknown AT ip216-239-69-74 DOT vif DOT net |
X-Cache: | nntpcache 2.4.0b4 (see http://www.nntpcache.org/) |
Lines: | 61 |
NNTP-Posting-Date: | Sun, 10 Feb 2002 13:32:01 CST |
X-Trace: | sv3-s3WL5Enku1o4HUcq86tMRxEvKHxw8hyCgKAHth2dICoJoSR1B79DoylmQwvPLC9GGOf+OjQ2NAIEc6N!cWqfCrxHqYScfFl/b9vRBXuHxxPZSQls3s1FjOPiOJkhoAKQzPH3 |
X-Complaints-To: | abuse AT GigaNews DOT Com |
X-DMCA-Notifications: | http://www.giganews.com/info/dmca.html |
X-Abuse-Info: | Please be sure to forward a copy of ALL headers |
X-Abuse-Info: | Otherwise we will be unable to process your complaint properly |
Date: | Sun, 10 Feb 2002 19:32:01 GMT |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
does GCC3.0.x support C++ exceptions properly?? or is it that I can't code them properly?? I have this code (stripped down for newsgroups): namespace Std { class Exception { public: char *message; Exception( char *message = NULL ); // this code works file! }; class foo { public: foo( char *filename ); }; } using namespace Std; foo::foo( char *filename ) { FILE *in; in = fopen( filename, "rb" ); if (in==NULL) throw Exception( "File not found" ); } //and finally: int main() { foo *bar; try { bar = new foo( "badfile.txt" ); // purposefully to check } catch( Exception e ) { printf( e.message ); // this line offends return 1; } delete bar; return 0; } NOW by my logic, this primitive program should output: File not found but it outputs nothing, yet if I change the line "printf( e.message);" to "printf( "Exception Caught: %s\n", e.message );", it outputs: Exception Caught: so it is catching the exceptions properly, but the values in the exception class is getting messed up. if somebody wants the complete (relevant) code, then i will e-mail it to them, but I think that this should be sufficient to debug the program. -- ************************************************************** * Sahab Yazdani * "Don't worry about what might be... worry * * Thornhill S.S * about what is." - Zeddicus Zu'l Zorander * ************************************************************** * http://pheonixsoft.virtualave.net/ * :) * **************************************************************
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |