Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有更受欢迎的替代方案?
当然这是一个很好的设计,每个人都知道可以期待它,并且它使用嵌套条件来击败它。
短路评估是大多数现代编程语言的关键特性,没有理由避免依赖它。没有它,与指针相关的测试将(不必要地)更加复杂且可读性更低。