By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,514 Members | 1,843 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,514 IT Pros & Developers. It's quick & easy.

Catching standard exceptions

P: n/a
------------------------
Visual C++ 6.0
Debug Mode
-----------------------

I have the following piece of code:

================
int* p;

try
{
p = new int [0x7FFFFFFF];
}
catch (exception& e)
{
cout << "Standard exception: " << e.what() << endl;
}
================

'new' failed, but system has catched the exception, not my catch.
The message "Standard exception: <text from e.what>" hasn't been shown.
System error message box (with relevant text) has been shown.

Why doesn't work catch in code below?

Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn

Nov 10 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Alex Vinokur" <al****@users.sourceforge.net> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com
------------------------
Visual C++ 6.0
Debug Mode
-----------------------

I have the following piece of code:

================
int* p;

try
{
p = new int [0x7FFFFFFF];
}
catch (exception& e)
{
cout << "Standard exception: " << e.what() << endl;
}
================

'new' failed, but system has catched the exception, not my catch.
The message "Standard exception: <text from e.what>" hasn't been
shown. System error message box (with relevant text) has been shown.

Why doesn't work catch in code below?


Because VC++ is a pre-standard compiler. There is a workaround in this case.

http://support.microsoft.com/?kbid=167733
--
John Carson

Nov 10 '05 #2

P: n/a
"John Carson" <jc****************@netspace.net.au> wrote in message
news:dk**********@otis.netspace.net.au

Because VC++ is a pre-standard compiler.


Naturally, I meant VC++ 6.0, as referred to by the OP.

--
John Carson
Nov 10 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.