|
|
|
|
|
by bryondowd
1776 days ago
|
|
I see short-circuit for correct behavior all the time, most frequently in the format:
if (pointer && pointer->member == value) Where you want to make sure a pointer you've been given isn't null before you try to dereference it. Without short-circuit, this becomes a segfault. |
|
I've never seen someone use an "or" pattern in a non-confusing way.
That is, I've seen "and" patterns that act as a safety/early out. I fail to see the use of an "or" pattern where you want to stop executing if the first value is true (ignoring using nots to invert the logic of an and pattern, and I would criticize that).