Why would a language NOT use Short-circuit evaluation?

后端 未结 18 1931
天涯浪人
天涯浪人 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:05

    Not that I think this is what's going on in any language now, but it would be rather interesting to feed both sides of an operation to different threads. Most operands could be pre-determined not to interfere with each other, so they would be good candidates for handing off to different CPUs.

    This kins of thing matters on highly parallel CPUs that tend to evaluate multiple branches and choose one.

    Hey, it's a bit of a stretch but you asked "Why would a language"... not "Why does a language".

提交回复
热议问题