HomeFreeBSD

SC2015: Note that A && B || C is not if-then-else. C may run when A is true.

Description

SC2015: Note that A && B || C is not if-then-else. C may run when A is true.

It's common to use A && B to run B when A is true, and A || C to run C
when A is false.

However, combining them into A && B || C is not the same as if A then B
else C.

In this case, if A is true but B is false, C will run.

If an if clause is used instead, this problem is avoided.

PR: 227109
Submitted by: mat
Sponsored by: Absolight

Details

Provenance
matAuthored on
Parents
rP471990: Don't exec with a pipe afterwards, it is weird.
Branches
Unknown
Tags
Unknown