Multiple return statements vs Multiple goto statements : which one would be preferable?
<p>I read that both multiple returns and multiple goto statements are bad programming practice. I have a function which can detect some 8 types of errors. In case of error, should i return error code or should i use goto statment to go to end of function and return from there. 
Whenever memory freeing is required before returning from function, i thought it would be better to have a goto end and free the memory at the end of the function(so that only one free is enough in function)</p>

<p>However, In my function, memory is not allocated.
In this case which one is preferable ? Multiple returns or multiple goto statements ?
Or can we avoid both ?</p>

<p>EDIT: Some way to avoid both is, pass parameter to function which can store errorType. Samething can be checked inside function before proceeding further. But this too makes the code ugly.</p>
