在Visual C ++ 2010中绕过列表迭代器解除引用错误 [英] Bypassing list iterator dereferencing error in Visual C++ 2010

查看:257
本文介绍了在Visual C ++ 2010中绕过列表迭代器解除引用错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我取消引用列表迭代器时,我收到一条错误,指出迭代器无法解除引用。但是,当我构建Release版本并且只发生在Debug版本上时,这不会发生。

When I dereference a list iterator, I get an error saying that the iterator can't be dereferenced. This however, doesn't happen when I'm building a Release version and only happens on the Debug version.

我有什么办法可以绕过这个错误吗?

Is there any way I can bypass this error ?

推荐答案

您不想绕过此检查。它告诉你你的代码出了问题,只有APPEARS会在发布模式下消失。实际发生的是你得到的未定义行为似乎按照你想要的方式工作。事实上,它将在未来的一些不可预测的地方失败,导致你更加悲痛,可能需要花费数小时的调试努力。

You don't want to bypass this check. It's telling you that something's wrong with your code and only APPEARS to go away in release mode. What's actually happening is that you're getting undefined behavior that seems to work the way you want it to. In fact, it will fail at some unpredictable point in the future causing you even more grief and possibly many hours of debugging effort.

这篇关于在Visual C ++ 2010中绕过列表迭代器解除引用错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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