When you run this code under the debugger , the assertion statement is evaluated , but in the release version , the comparison is not made , so there is no additional overhead 当在调试器下运行该代码时,将计算断言语句,但是在发布版本中,将不进行该比较,因此没有额外的系统开销。
Discusses assertion statements , how they work , the benefits of using them catching logic errors , checking results of an operation , and testing error conditions , their interaction with 讨论断言语句,包括它们的工作方式,使用它们的好处(捕捉逻辑错误、检查操作的结果和测试错误情况) ,它们与
Therefore , assertion statements have zero overhead in your final release program ; you can use them liberally in your code without affecting the performance of your release version and without having to use 因此,断言语句在最终发布程序中系统开销为零;可以在代码中大量使用断言语句,而不影响“ release ”版本的性能,并且不必使用