c++ - 关于抛出异常的一些问题
伊谢尔伦
伊谢尔伦 2017-04-17 13:37:23
0
1
359

cpp primer5的ch18.11的问题:为什么异常类的what函数不应该抛出异常?

想问一下:

抛出异常时为了程序能处理无法预料的情况,那么what只是输出字符串,所以不会触发异常..对不?
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
小葫芦

This is a question of API design. The what function is usually called in the catch statement.
try/catch originally has the function of adding insurance.
If an exception is thrown in what, try/ What’s the use of catch?
Does every catch need to be preceded by a try/catch?
Isn’t this a scam?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template