"not all control paths return a value"
Posted on 2001-08-09
I'm fond of writing loops with a return statement in the body, usually when there need not be any other return statement...for example,
for(int i=0; i<arraySize; i++)
if(array[i] == TRUE)
You usually get a compiler warning for this sort of thing. I typically argue that I'm well aware that not all paths return a value because, say, I know that there will be at least one array[i] that will be true (or something like that)
My question is, is this a bad coding practise? It is unabasahed laziness on my part, that's for sure, but how harmful is it?