Why not use exceptions as regular flow of control?

后端 未结 24 1858
心在旅途
心在旅途 2020-11-21 07:30

To avoid all standard-answers I could have Googled on, I will provide an example you all can attack at will.

C# and Java (and too many others) have with plenty of ty

24条回答
  •  情深已故
    2020-11-21 08:03

    Have you ever tried to debug a program raising five exceptions per second in the normal course of operation ?

    I have.

    The program was quite complex (it was a distributed calculation server), and a slight modification at one side of the program could easily break something in a totally different place.

    I wish I could just have launched the program and wait for exceptions to occur, but there were around 200 exceptions during the start-up in the normal course of operations

    My point : if you use exceptions for normal situations, how do you locate unusual (ie exceptional) situations ?

    Of course, there are other strong reasons not to use exceptions too much, especially performance-wise

提交回复
热议问题