Often I built functions, in C, that checks some parameters and return an error code.
Which is the best approach to stop the values checking when I found an error?
Funny nobody noticed, that the above 2nd example demonstrates, why the MISRA rule exists in the first place: it leaves out a default return value for all cases where the if clauses do not match.
So what happens, if (foo == bar) && (foo1 == bar1) && (foo2 == bar2) ?
Moreover, in the 1st example for me it's easier to grasp, in which special case there is a non-default return value.