抓住了非std异常 [英] caught non-std exception

查看:64
本文介绍了抓住了非std异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在FC4上用g ++使用STL和Posix线程

和套接字我正在捕获一个异常,即

不是std :: exception。知道它可能是什么?
可能是什么?我的捕捉宏的轮廓是

以下。


谢谢,

迈克。


#define MY_MACRO \

catch(MyExceptions& e)\

{\

... \\处理它们\

} \

catch(std :: exception& e)\

{\

... \\处理他们\

} \

catch(...)\

{ \

... \\这是什么\

}

On FC4 with g++ using STL and Posix threads
and sockets I am catching an exception that
is not a std::exception. Any idea what it
might be? An outline of my catch macro is
below.

Thanks,
Mike.

#define MY_MACRO \
catch (MyExceptions& e) \
{ \
... \\ process them \
} \
catch (std::exception& e) \
{ \
... \\ process them \
} \
catch (...) \
{ \
... \\ what is this \
}

推荐答案

Mike写道:
在FC4上用g ++使用STL和Posix线程
和套接字我正在捕获一个异常,即
不是std :: exception。知道它可能是什么?我的捕获宏的概述如下。

谢谢,
迈克。

#define MY_MACRO \
catch(MyExceptions& e)\
{\
... \\处理它们\
} \
catch(std :: exception& e)\
{\
... \\处理他们\
} \
赶上(...)\
{\
... \\这是什么\
}
On FC4 with g++ using STL and Posix threads
and sockets I am catching an exception that
is not a std::exception. Any idea what it
might be? An outline of my catch macro is
below.

Thanks,
Mike.

#define MY_MACRO \
catch (MyExceptions& e) \
{ \
... \\ process them \
} \
catch (std::exception& e) \
{ \
... \\ process them \
} \
catch (...) \
{ \
... \\ what is this \
}




我不知道,但有些系统会给你C ++风格

异常信号,如分段

违反除零。


我假设你排除了所有自定义异常

决定不从std :: exception派生出来?


尝试在gdb中运行程序,当它停止时

a backtrace with the quot; bt"命令并查看哪个

函数是在之前(及时),即

以下(在打印输出中),类似于

a" ;抛出。


HTH,

- J.



I have no idea, but some systems give you C++-style
exceptions in the event of a signal, like a segmentation
violation of division by zero.

I assume you have ruled out all custom exceptions
that have decided not to derive from std::exception?

Try running the program in gdb, when it stops do
a backtrace with the "bt" command and see which
function is immediately before (in time), that is
below (in the printout), something that resembles
a "throw".

HTH,
- J.


2006年3月18日星期六21:27:58 +0100,Jacek Dziedzic写道:
On Sat, 18 Mar 2006 21:27:58 +0100, Jacek Dziedzic wrote:
Mike写道:
在FC4上用g ++使用STL和Posix线程
和套接字我发现了一个例外,即
不是std :: exception。知道它可能是什么?我的catch宏的大纲如下所示。
On FC4 with g++ using STL and Posix threads
and sockets I am catching an exception that
is not a std::exception. Any idea what it
might be? An outline of my catch macro is
below.


[...]我假设你已经排除了所有已经决定不从std :: exception派生的自定义异常


尝试在gdb中运行程序,当它停止时使用bt进行回溯。命令并查看之前(时间)的功能,即下面(在打印输出中),类似于抛出的东西。
HTH,
- J。

[...] I assume you have ruled out all custom exceptions
that have decided not to derive from std::exception?

Try running the program in gdb, when it stops do
a backtrace with the "bt" command and see which
function is immediately before (in time), that is
below (in the printout), something that resembles
a "throw".

HTH,
- J.




很抱歉打扰你。我有:

throw(MyStuff);

而不是:

抛出MyException(MyStuff);


我对它编译感到惊讶。


Mike。



Sorry to trouble you with a typo. I had:
throw(MyStuff);
instead of:
throw MyException(MyStuff);

I am surprised that it compiled.

Mike.


Mike - EMAIL IGNORED< m_ *************@yahoo.com>写道:
Mike - EMAIL IGNORED <m_*************@yahoo.com> wrote:
很抱歉打扰你。我有:
抛出(MyStuff);
而不是:
抛出MyException(MyStuff);

我很惊讶它编译了。
Sorry to trouble you with a typo. I had:
throw(MyStuff);
instead of:
throw MyException(MyStuff);

I am surprised that it compiled.




为什么?你几乎可以抛出一切。实际上,我想不到你不能扔的任何东西。


问候

-

jb


(rot13中的回复地址,先解读)



Why? You can throw pretty much everything. Actually, I cannot think
of anything you cannot throw.

regards
--
jb

(reply address in rot13, unscramble first)


这篇关于抓住了非std异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆