It seems like `return foo();` where foo() is a void function can always be replaced with `foo(); return;` for greater clarity at the cost of one extra line break. For people who prefer the one-line style, can you say why you don’t like the other way?
- Maciej > On Feb 20, 2019, at 10:33 AM, Simon Fraser <simon.fra...@apple.com> wrote: > > I find it mind bending. It makes me wonder if the author made a coding error. > > Simon > >> On Feb 20, 2019, at 7:48 AM, Daniel Bates <dba...@webkit.org >> <mailto:dba...@webkit.org>> wrote: >> >> Thanks for the opinion! >> >> Dan >> >> On Feb 20, 2019, at 7:26 AM, Saam Barati <sbar...@apple.com >> <mailto:sbar...@apple.com>> wrote: >> >>> I prefer it as well. >>> >>> - Saam >>> >>> On Feb 20, 2019, at 6:58 AM, Chris Dumez <cdu...@apple.com >>> <mailto:cdu...@apple.com>> wrote: >>> >>>> I also prefer allowed returning void. >>>> >>>> Chris Dumez >>>> >>>> On Feb 19, 2019, at 10:35 PM, Daniel Bates <dba...@webkit.org >>>> <mailto:dba...@webkit.org>> wrote: >>>> >>>>> >>>>> >>>>> On Feb 19, 2019, at 9:42 PM, Ryosuke Niwa <rn...@webkit.org >>>>> <mailto:rn...@webkit.org>> wrote: >>>>> >>>>>> On Tue, Feb 19, 2019 at 8:59 PM Daniel Bates <dba...@webkit.org >>>>>> <mailto:dba...@webkit.org>> wrote: >>>>>> > On Feb 7, 2019, at 12:47 PM, Daniel Bates <dba...@webkit.org >>>>>> > <mailto:dba...@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. >>>>>> >>>>>> I don't think there is a sufficient consensus as far as I can tell. Geoff >>>>> >>>>> I didn't get this from Geoff's remark. Geoff wrote: >>>>> >>>>> ***“return f()” when f returns void is a bit mind bending.*** >>>>> Don't want to put words in Geoff's mouth. So, Geoff can you please >>>>> confirm: for the former style, for the latter style, no strong opinion. >>>>> >>>>>> and Alex both expressed preferences for being able to return void, >>>>> >>>>> I got this from Alex's message >>>>> >>>>>> and Saam pointed out that there is a lot of existing code which does >>>>>> this. >>>>> >>>>> I did not get this. He wrote emphasis mine: >>>>> >>>>> 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. >>>>> >>>>>> Zalan also said he does this in his layout code. >>>>> >>>>> I did not get this, quoting, emphasis mine: >>>>> >>>>> I use this idiom too in the layout code. I guess I just prefer a more >>>>> compact code. >>>>> ***(I don't feel too strongly about it though)*** >>>>> >>>>> By the way, you even acknowledged that "WebKit ... tend[s] to have a >>>>> separate return.". So, I inferred you were okay with it. But from this >>>>> email I am no longer sure what your position is. Please state it clearly. >>>>> >>>>>> - R. Niwa >>>>>> >>>>> _______________________________________________ >>>>> webkit-dev mailing list >>>>> webkit-dev@lists.webkit.org <mailto:webkit-dev@lists.webkit.org> >>>>> https://lists.webkit.org/mailman/listinfo/webkit-dev >>>>> <https://lists.webkit.org/mailman/listinfo/webkit-dev> >>>> _______________________________________________ >>>> webkit-dev mailing list >>>> webkit-dev@lists.webkit.org <mailto:webkit-dev@lists.webkit.org> >>>> https://lists.webkit.org/mailman/listinfo/webkit-dev >>>> <https://lists.webkit.org/mailman/listinfo/webkit-dev> >> _______________________________________________ >> webkit-dev mailing list >> webkit-dev@lists.webkit.org <mailto:webkit-dev@lists.webkit.org> >> https://lists.webkit.org/mailman/listinfo/webkit-dev > > _______________________________________________ > webkit-dev mailing list > webkit-dev@lists.webkit.org > https://lists.webkit.org/mailman/listinfo/webkit-dev
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev