Short-circuit evaluation in C can cause unit test failures when functions inside boolean conditions are never called due to the optimizer skipping them. Using a stub function with a call counter reveals that when the first condition is FALSE, the second function is never invoked — which can hide side effects like hardware register reads or global variable writes. The recommended fix is to store the function's return value in a temporary variable before the conditional, ensuring the function always executes regardless of other conditions.
33 Impressions