3 ms·
I'm not sure if it's that simple. Sometimes, you want to guard your code with an early return, which means `if (x == NULL) return errorvalue;`. However, if the
by mort96 8y ago
I'm not sure if it's that simple. Sometimes, you want to guard your code with an early return, which means `if (x == NULL) return errorvalue;`. However, if the function should handle both cases, I prefer to start with the "happy path", which usually means `if (x != NULL) { happy; } else { handle_sad_case; }`.
- troels 8y agoYeah, I was addressing the inconsistent space between "if" and opening parentheses.