Consider the following contrived example:
void HandleThat() { ... } void HandleThis() { if (That) return HandleThat(); ... }
This code works very well, and I'm sure it is specified, but I (perhaps by myself) consider this unusual style, as the call seems to return the result of the function, despite the fact that both functions are prototyped as invalid.
Typically, I expect to see:
if (That) {HandleThat(); return;}
which, I feel, leaves no ambiguity as to what is happening.
SO community, can I express your opinion on the confusing or problematic coding style of return-void? It has a sense of idiom; should this be used or avoided?
In general, I would strive for clarity and use a second style. On the other hand, there is accuracy in the first form, which attracts me a little.
c ++ idioms coding-style
Dave Gamble Aug 6 '09 at 19:28 2009-08-06 19:28
source share