Article View: borland.public.cppbuilder.nativeapi
Article #14958Exception handling
From: Yahia El-Qasem
Date: Wed, 23 Jul 2003 19:34
Date: Wed, 23 Jul 2003 19:34
61 lines
2669 bytes
2669 bytes
Hi :-)
I asked the following on language.cpp and since it deals with OS exceptions
+ C++ exceptions I post here too to get the other half :-)
AFAIK the C++ standard says that all exceptions shouldn't evolve out out the
following code block :
{
try {
// here comes some code... any exception should be absorbed by the
following catch(...) ?!?
}
catch(...)
{
};
}
BUT I experienced that with some third party components / Win32 API calls
exceptions occur which just aren't catched by the above code.
Then I tried some options and came up with the following code :
{
try {
try {
try {
// here comes some code...
}
__except ( EXCEPTION_EXECUTE_HANDLER )
{
};
}
catch (...)
{
};
}
__finally
{
};
}
This code absorbs now all exceptions ( C++ ones AND Win32 ones AND whatever
comes from third party components like DOA ). It works usually good but
shows sometimes strange behaviour ( like just freezing the app OR having
some exceptions i.e. from ActiveX interfaces still come up in a dialog... ).
The purpose of the above code is to make sure that all exceptions are
handled in a way that my clean up code following the block you see always
gets executed...
Then I read that mixing C and C++ try / catch /__except / __finally is
somehow not recommended and buggy in BCB 5 and 6...
Could someone be so kind to provide me with some details on this ?
Thanks in advance
Yahia
Technical Details
Message-ID:
<3f1ee3c0@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!pln-w!extra.newsguy.com!lotsanews.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,9958034f094baec7,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-23 12:40:41 PST Reply-To: "Yahia El-Qasem" <Yahia.El-Qasemno.spam@mgh.metro-ag.de> From: "Yahia El-Qasem" <Yahia.El-Qasem@mgh.metro-ag.de> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Exception handling Date: Wed, 23 Jul 2003 21:34:57 +0200 Lines: 64 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 217.83.109.54 Message-ID: <3f1ee3c0@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1058988992 217.83.109.54 (23 Jul 2003 12:36:32 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!pln-w!extra.newsguy.com!lotsanews.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail