Is short-circuiting logical operators mandated? And evaluation order?

前端 未结 7 2584
广开言路
广开言路 2020-11-21 04:11

Does the ANSI standard mandate the logical operators to be short-circuited, in either C or C++?

I\'m confused for I recall the K&R book saying your code

相关标签:
7条回答
  • Straight from good old K&R:

    C guarantees that && and || are evaluated left to right — we shall soon see cases where this matters.

    0 讨论(0)
提交回复
热议问题