在MFC应用程序中处理断言失败的最佳方法。 [英] Best way to handle Assertions failures in MFC applications.

查看:204
本文介绍了在MFC应用程序中处理断言失败的最佳方法。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friends,



i创建了基于类型dialouge的应用程序,并将FranmewinEx集成为基类窗口。当我将两个Docuable窗格类文档分类为其工作时在发布模式中很好。打开openGL启用的上下文是可见的并且可以正常运行..当我在deburg中运行相同的代码时。在窗口创建时给出一些dubug断言失败。

其崩溃窗口线程在那个dubug break函数之后。我想知道处理这种异常的过程。我想知道是否可以通过最新的MFC版本解决,

和我使用过MFC 10.0 Visual studio 2010请提供以后更新的指导我可以使用代码2010至2013视觉工作室if所以请告诉我转换的方式..







谢谢和问候

srinivas。

Hello Friends,

i have created the application with type dialouge based and integrated the the FranmewinEx as Base class window.when i docuked two Docuable pane classes sentimentally its working fine in release mode.means opening the openGL Enabled contexts are visible and rending the fine..when i run the same code in deburg .its giveing some dubug assertions failures while window creation.
its crash window Thread after that dubug break function.i would like to know the procedure of handle this type of exceptions. and i would like to know will it be resolved with latest MFC releases,
and i have used MFC 10.0 Visual studio 2010 Please provide the guidance for later updates can i use the code 2010 to 2013 visual studio if so please let me know the way of conversion..



thanks and regards
srinivas.

推荐答案

处理断言失败的最佳方式(实际上,唯一的方法)是返回源代码并修复bug。



这些断言并非旨在作为其他例外处理,这些例外可能是也可能是不可接受的。断言的目的是为了捕捉当你作为开发人员认为某些谓词始终为真时的情况,所以你要检查它,但事实证明在运行时期间是假的。它只是意味着你制造了一个bug。 断言是一种开发工具,如调试器,跟踪和类似的东西,而不是运行时工具。



请参阅:

http://en.wikipedia.org/wiki/Assertion_%28computing%29 [ ^ ]。



-SA
Best way (and actually, the only way) to handle assertion failures is to go back to source code and fix the bug.

The assertions are not designed to be handled as other exceptions, which may or may not be acceptable. The purpose of the assertion is to capture the situation when you, as a developer, think that some predicate is always true, so your check it up, but it turns out to be false during runtime. It simply means that you made a bug. An assertion is a development tool, like debugger, tracing and similar things, not a runtime facility.

Please see:
http://en.wikipedia.org/wiki/Assertion_%28computing%29[^].

—SA


这篇关于在MFC应用程序中处理断言失败的最佳方法。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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