This Stack Overflow Q&A This Stack Overflow Q&A describes some good ways to deal with errors and return values.
This Stack Overflow Q&A describes some good ways to deal with errors and return values.
This Stack Overflow Q&A describes some good ways to deal with errors and return values.
But as others have said as others have said this is nit-picking: consistency is king. Writing professional code is writing code that nicely blends into the existing code base, because it doesn't use a different bracing or spacing style. And it's consistently consistent.
As for the actual implementation, as already mentioned as already mentioned returning early is never a bad idea; it removes the noise and lets you focus on the "clean" execution path:
But as others have said this is nit-picking: consistency is king. Writing professional code is writing code that nicely blends into the existing code base, because it doesn't use a different bracing or spacing style. And it's consistently consistent.
As for the actual implementation, as already mentioned returning early is never a bad idea; it removes the noise and lets you focus on the "clean" execution path:
But as others have said this is nit-picking: consistency is king. Writing professional code is writing code that nicely blends into the existing code base, because it doesn't use a different bracing or spacing style. And it's consistently consistent.
As for the actual implementation, as already mentioned returning early is never a bad idea; it removes the noise and lets you focus on the "clean" execution path:
Arguably since the number of iterations is known from the start, a for
loop would have been more appropriate than a while(1)
infinite loop.
Arguably since the number of iterations is known from the start, a for
loop would have been more appropriate than a while(1)
infinite loop.