3 ms·
Because it's syntax which looks like an expression but isn't fully evaluated. That's unusual, C syntax is complex and new users are often very focused on figur
by samatman 4y ago
Because it's syntax which looks like an expression but isn't fully evaluated.
That's unusual, C syntax is complex and new users are often very focused on figuring out pointers, you can miss that `= a() && b() || c();` always calls b and c but that `= a() ? b() : c();` only calls one of them depending on whether a is zero.
- chaosite 4y agoAm I missing something? && are || are short-circuiting operators in C, so in that example b and c won't always be called either.
- samatman 4y agoNo you're correct of course. I could go back and edit it to be & and |, but I think leaving the easy-for-a-noob to make mistake in actually illustrates the point better. It wasn't on purpose, my brain took a shortcut from the eager logical operators I work with more frequently.