views:

52

answers:

1

How common is it for coding style guidelines to include a requirement that all functions include at least one return statement (even functions which return void)?

To avoid being subjective or argumentative, I'd like answers which can name specific companies or open-source projects which have this requirement. If you haven't ever come across this coding style guideline, or you have a resource (book, online article) which discusses it, that would be useful as well.

Thanks!

+1  A: 

FWIW, I've never seen such a guideline at either of the (C++) companies I've worked for.

My first company did have a guideline about minimising the number of points of return. For functions returning void that would implicitly imply that they preferred there to be no return statements in the function I suppose.

Troubadour
Agreed, I've never heard the requirement for return statements in void functions. The idea strikes me as dogmatic.
dpurrington