Message-ID: <356F7485.2F71@banet.net> Date: Fri, 29 May 1998 22:52:53 -0400 From: gavlene AT banet DOT net Reply-To: gavlene AT banet DOT net MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: try, throw, catch & const Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 129.37.113.57 Organization: IBM.NET Lines: 28 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk hi, can someone tell me why the following catch failed if a const is used? it works if no const used in front of char *. this piece of code works in Sun C++ compiler. thanks, leetravis AT hotmail DOT com int main(int argc, char *argv[]) { try { throw "unable to catch"; } catch (const char* sError) { // fails to catch // catch (char* sError) { cerr << sError << endl; exit(1); } catch (...) { cerr << "unknow exception throw" << endl; exit(1); } return(0); }