Why would a language NOT use Short-circuit evaluation?

后端 未结 18 1971
天涯浪人
天涯浪人 2020-12-03 09:42

Why would a language NOT use Short-circuit evaluation? Are there any benefits of not using it?

I see that it could lead to some performances issues... is that true?

18条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 10:19

    Because short-circuiting can change the behavior of an application IE:

    if(!SomeMethodThatChangesState() || !SomeOtherMethodThatChangesState())
    

提交回复
热议问题