[webkit-dev] Code Style: Opinion on returning void

Daniel Bates dbates at webkit.org
Tue Feb 19 20:59:11 PST 2019


> On Feb 7, 2019, at 12:47 PM, Daniel Bates <dbates at webkit.org> wrote:
>
> Hi all,
>
> Something bothers me about code like:
>
> void f();
> void g()
> {
>     if (...)
>         return f();
>     return f();
> }
>
> I prefer:
>
> void g()
> {
>     if (...) {
>         f();
>         return
>     }
>     f();
> }
>
Based on the responses it seems there is sufficient leaning to codify
the latter style.

Patch posted <https://bugs.webkit.org/show_bug.cgi?id=194848> for
review of language and examples.

Summary of this thread is in that bug, too.

Dan


> Does it bother you? For the former? For the latter? Update our style guide?
>
> Opinions, please.
>
> Dan


More information about the webkit-dev mailing list