[ACCEPTED]-Is a blank return statement at the end of a function whos return type is void necessary?-gnu
No; that is not needed.
You only need to 2 write
return; if you want to return early and skip 1 the rest of the function.
You are correct,
return; is never needed in a function 1 that is not breaking out of itself early.
Return is explicit. It conveys that the 9 author clearly understood that there was 8 no value to return.
BTW - there should only 7 be one return allowed, but that is another 6 discussion (so don't answer it here!!).
Also, from 5 a code maintenance point of view, "return;" provides 4 a convenient spot to add a value, if the 3 function is ever changed from void.
Leave 2 it in! The object is not to see who can 1 write the function with the fewest lines.
More Related questions