C ++异常处理有缺陷 [英] C++ exception handling is defective

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

问题描述

C ++堆栈解析的简单性并非没有缺陷

后果。以下文章指出了显示

缺陷的C ++示例。知道缺陷的工程师可以避免难以发现的错误。

http://distributed-software.blogspot...defective.html


问候,
zo****@ZHMicro.com
http://www.zhmicro.com
http://distributed-software.blogspot.com
http://groups-beta.google.com/group/...Z?lnk=la&hl=en

The simplicity of stack unraveling of C++ is not without defective
consequences. The following article points to C++ examples showing the
defects. An engineer aware of defects can avoid hard-to-find bugs.

http://distributed-software.blogspot...defective.html

Regards,
zo****@ZHMicro.com
http://www.zhmicro.com
http://distributed-software.blogspot.com
http://groups-beta.google.com/group/...Z?lnk=la&hl=en

推荐答案

Zorro写道:
Zorro wrote:

C ++堆栈解析的简单性是并非没有缺陷

后果。以下文章指出了显示

缺陷的C ++示例。知道缺陷的工程师可以避免难以发现的错误。

The simplicity of stack unraveling of C++ is not without defective
consequences. The following article points to C++ examples showing the
defects. An engineer aware of defects can avoid hard-to-find bugs.

http://distributed-software.blogspot...defective.html


从那里链接的PDF中的所有C ++示例都没有实际使用

异常处理。它们都调用未定义的行为。他们没有在C ++的异常处理中显示出一个

缺陷,而是缺乏对C ++的作者的理解。


顺便说一句:这些例子也使用了< iostream.hheader已经过了大约10年的C ++已经过时了,实际上从来没有过。

C ++标准的一部分。

http://distributed-software.blogspot...defective.html

None of the C++ examples in the PDF linked from there is actually using
exception handling. They all invoke undefined behavior. They don''t show a
defect in C++''s exception handling, but rather a lack of the author''s
understanding of C++.

BTW: Those examples are also using the <iostream.hheader that has been
outdated in C++ for about 10 years now and has actually never even been
part of the C++ Standard.


Rolf Magnus写道:
Rolf Magnus wrote:

Zorro写道:

Zorro wrote:


>> C ++的堆栈解析的简单性并非没有缺陷的后果。以下文章指出了显示
缺陷的C ++示例。知道缺陷的工程师可以避免难以发现的错误。

>>The simplicity of stack unraveling of C++ is not without defective
consequences. The following article points to C++ examples showing the
defects. An engineer aware of defects can avoid hard-to-find bugs.


http://distributed-software.blogspot...defective.html

从那里链接的PDF中的C ++示例都没有实际使用

异常处理。它们都调用未定义的行为。他们没有在C ++的异常处理中显示出一个

缺陷,而是缺乏对C ++的作者的理解。


http://distributed-software.blogspot...defective.html

None of the C++ examples in the PDF linked from there is actually using
exception handling. They all invoke undefined behavior. They don''t show a
defect in C++''s exception handling, but rather a lack of the author''s
understanding of C++.



同意,我想知道哪个编译器和环境产生了结果

声称。

Agreed, I wonder which compiler and environment produced the results
claimed.


BTW :这些例子也使用了< iostream.hheader已经过了10年的C ++已经过时了,实际上从来没有像B ++标准那样是b $ b的一部分。
BTW: Those examples are also using the <iostream.hheader that has been
outdated in C++ for about 10 years now and has actually never even been
part of the C++ Standard.



更不用说惯用的C(无效)。


-

Ian Collins 。

Not to mention idiomatic C (void).

--
Ian Collins.


" Zorro" < zo **** @ comcast.netwrote in message

news:11 ********************** @ o58g2000hsb.googlegr oups.com ...
"Zorro" <zo****@comcast.netwrote in message
news:11**********************@o58g2000hsb.googlegr oups.com...

C ++的堆栈解析的简单性并非没有缺陷

后果。以下文章指出了显示

缺陷的C ++示例。知道缺陷的工程师可以避免难以发现的错误。

The simplicity of stack unraveling of C++ is not without defective
consequences. The following article points to C++ examples showing the
defects. An engineer aware of defects can avoid hard-to-find bugs.

http://distributed-software.blogspot...ing-is-defecti

ve.html


事实上代码示例使用< iostream.hand not< iostreamsuggests

a非常旧的编译器用于演示假定的异常错误。如果为< iostrea更新了

代码,则将除以零的部分替换为抛出

(/ 0导致未定义的行为)并使用更新的编译器,我认为

你会发现当堆栈被解开时确实会调用析构函数。它看起来像一个有缺陷的编译器而不是有缺陷的语言。


DW

http://distributed-software.blogspot...ing-is-defecti
ve.html

The fact that the code samples use <iostream.hand not <iostreamsuggests that
a very old compiler was used to demonstrate the supposed exception bugs. If the
code is updated for <iostreamand the divisions by zero are replaced by throws
(/0 causes undefined behaviour) and a more recent compiler is used, I think
you''ll find that the destructor is indeed called when the stack is unwound. It
looks like a defective compiler rather than a defective language.

DW


这篇关于C ++异常处理有缺陷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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