|
From: Per W. <pw...@ia...> - 2003-05-16 12:10:40
|
Or do:
void fun() {
int state = 0;
try {
fun1();
state++;
fun2();
state++;
fun3();
state++
...
} catch (x) {
switch (sate) {
case 0: cout << "fun1() is bad"; break;
case 1: cout << "fun2() is bad"; break;
...
}
}
EMA System email: pw...@ia...
Per Westermark web: http://iapetus.neab.net
Vargvaegen 174B phone: +46 70 214 74 48
S-906 42 Umeaa
Sweden
On Fri, 16 May 2003, philip MORTIMER wrote:
> Hello Zodiaq,
>
> You could have funX pass a code to smallFun which indicates
> what function called it (eg fun11 would pass 11 to FunQ), and
> when smallFun throws an exception it can include this
> code in the exception object, so that when FunQ catches it
> it knows which function called smallFun.
>
> --------------------------------------------------------------------------
> Philip Mortimer
>
> www: http://mysite.freeserve.com/coniferway/index.html.
>
> Available for short and long term contracts
> ---------------------------------------------------------------------------
>
> ----- Original Message -----
> From: "Zodiaq" <zo...@ac...>
> To: <Dev...@li...>
> Sent: Friday, May 16, 2003 12:03 AM
> Subject: [Dev-C++] about exceptions
>
>
> > Hello all Dev-cpp-users,
> >
> > I have one important question - this small example will show what my
> > mail is all about... let's say I have one major function (FunQ) which
> > calls many smaller functions(fun1 - fun20), and all of these functions
> > uses the same small function (smallFun) which conditionaly may throw
> > exceptions... only FunQ catches these exceptions... is there some a
> > way to know which way this exception came apart from rethrowing it
> > from funX (where X is number 1-20)... adding in many points in every
> > fun1-fun20 try...catch is what I want to avoid... maybe there is
> > something similar like __LINE__ or __FILE__ but about call stack??
> >
> > --
> > regards Zodiaq
> >
> >
> >
> > -------------------------------------------------------
> > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
> > The only event dedicated to issues related to Linux enterprise solutions
> > www.enterpriselinuxforum.com
> >
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
>
>
> -------------------------------------------------------
> Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
> The only event dedicated to issues related to Linux enterprise solutions
> www.enterpriselinuxforum.com
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|