Hacker News new | ask | show | jobs
by mort96 2914 days 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; }`.
1 comments

Yeah, I was addressing the inconsistent space between "if" and opening parentheses.