索引超出数组界限会在C ++核心之前引发异常或错误吗? [英] will Index Out Of Array Bounds throw exception or error before core in C++?
本文介绍了索引超出数组界限会在C ++核心之前引发异常或错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在C ++中取芯时,索引超出数组范围会抛出异常或错误吗?
will Index Out Of Array Bounds throw exception or error when coring in C++?
我知道如果存在超出数组范围的索引,那么该代码将存在一个未定义的动作. 但是什么时间会成为核心?
I know if index out of array bound existed, there will exist one undefined actions for the code. but what time it will core?
程序是否在核心之前弹出错误/异常?
if the program will popup error/exception before it will core?
我可以捕捉异常或错误吗?
can I catch the exception or error be core?
推荐答案
总之,您永远无法确定.
In short, you can never be sure.
对数组的无限制访问会在C ++中导致未定义的行为,不会引发异常.
An out of bounds access to an array causes undefined behavior in C++, it won't throw an exception.
这篇关于索引超出数组界限会在C ++核心之前引发异常或错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文