What's better/faster? Try-catch or avoid exception?

前端 未结 8 920
花落未央
花落未央 2021-01-08 01:32

I would like to know, what\'s better or/and faster in general programming? Avoid the exception or wait for the exception?

Avoid the exception would be:



        
8条回答
  •  庸人自扰
    2021-01-08 01:51

    Exceptions are expensive - if you can test and avoid the exception, do so.

    Exceptions should not be used for normal program flow.

提交回复
热议问题