所谓的判断short circuiting,是指在条件判断式中,如果前者已经满足了先决条件,就不会执行后置的表达式。例如下面这个程序:
1 | int x = 0; |
屏幕输出为00。这个操作不是编译时处理,而是程序运行时处理的,因此,即便是换成以下程序
1 | int x; |
当输入0时也仍然输出00。判断的实现是基于条件下的跳转,而不是编译器优化。
所谓的判断short circuiting,是指在条件判断式中,如果前者已经满足了先决条件,就不会执行后置的表达式。例如下面这个程序:
1 | int x = 0; |
屏幕输出为00。这个操作不是编译时处理,而是程序运行时处理的,因此,即便是换成以下程序
1 | int x; |
当输入0时也仍然输出00。判断的实现是基于条件下的跳转,而不是编译器优化。
Author: Victrid
Permanent Link: https://victrid.dev/2020/pan-duan-de-duan-lu-gui-ze/
License: Copyright (c) 2022 victrid Terms of Use
Read our privacy policy on how these personalized advertisements are delivered to you.
For your reading experience, we provide full-text RSS feeds. Although math formulas cannot be displayed well, the interface can be adjusted as you like and there are no ads.