如果代码给方法传递错误的元素,那么尽管代码将编绎良好,但可能会导致运行时错误或者不返回任何结果。
If your code passes the wrong element to the method, the code compiles fine, but might raise a runtime error or silently return no results.
这种方法的缺点在于签名录入的错误或含糊不清可能会导致没有征兆的故障,这也就意味着代码可以编译,但在运行时无法正确完成操作。
The downside of this approach is the possibility that a typo or slight ambiguity in the signature will silently fail, which means the code will compile but "do the wrong thing" at runtime.
任何无效迭代器的使用都可能导致运行时错误,但程序不一定会崩溃,否则检查这种错误也许会容易些。
Any use of an invalidated iterator is likely to yield a run-time error, but there is no guarantee that the program will crash or otherwise make it easy to detect the problem.
标准库不要求检查索引值,所用索引的下标越界是没有定义的,这样往往会导致严重的运行时错误。
The library is not required to check the value of the index. Using an index that is out of range is undefined and usually results in a serious run-time error.
标准库不要求检查索引值,所用索引的下标越界是没有定义的,这样往往会导致严重的运行时错误。
The library is not required to check the value of the index. Using an index that is out of range is undefined and usually results in a serious run-time error.
应用推荐