#3
by YuO » 3年前
||の第1引数が真ならば、第2引数は評価されない、となっています。
ref)
https://www.gnu.org/software/gnu-c-manu ... -Operators の第2文
The GNU C Reference Manual さんが書きました:
The logical disjunction operator || tests if at least one of two expressions it true. If the first expression is true, then the second expression is not evaluated.
このため、
h1j1k1 さんが書きました: ↑3年前
gccコンパイラにおいて、論理演算のorで、一つでも真値が出た場合はそれ以降の条件式は評価されますか?
に関しては「評価されません」。
オフトピック
遅くともC89以降、この動作が標準に定められた動作になります。
||の第1引数が真ならば、第2引数は評価されない、となっています。
ref) https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Logical-Operators の第2文
[quote=The GNU C Reference Manual]
The logical disjunction operator || tests if at least one of two expressions it true. If the first expression is true, then the second expression is not evaluated.
[/quote]
このため、
[quote=h1j1k1 post_id=155134 time=1599979702 user_id=2529]
gccコンパイラにおいて、論理演算のorで、一つでも真値が出た場合はそれ以降の条件式は評価されますか?
[/quote]
に関しては「評価されません」。
[offtopic]遅くともC89以降、この動作が標準に定められた動作になります。[/offtopic]