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

Saam Barati sbarati at apple.com
Thu Feb 7 14:20:43 PST 2019



> On Feb 7, 2019, at 12:53 PM, Tim Horton <timothy_horton at apple.com> wrote:
> 
> 
> 
>> 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();
>> }
> 
> ⸘do people do this‽
I've definitely done this in JSC. I don't think it's super common, but I've also seen code in JSC not written by me that also does this.

- Saam

> 
>> I prefer:
>> 
>> void g()
>> {
>>    if (...) {
>>        f();
>>        return
>>    }
>>    f();
>> }
>> 
>> Does it bother you? For the former? For the latter? Update our style guide?
> 
> +1 to a style guide update
> 
>> Opinions, please.
>> 
>> Dan
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev



More information about the webkit-dev mailing list