sourcenouveau
sourcenouveau

Reputation: 30534

Return statements for all functions

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!

Upvotes: 0

Views: 119

Answers (1)

Troubadour
Troubadour

Reputation: 13431

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.

Upvotes: 1

Related Questions