echristo added a comment.

In https://reviews.llvm.org/D27872#628212, @timshen wrote:

> I changed type style to early return.
>
> For constructors and destructors, I use:
>
>   if (...) {
>     // statement;
>     return;
>   }
>   
>
> For normal functions that returns void, I chose:
>
>   if (...)
>     return Foo();
>   llvm_unreachable(...);
>
> since it's more compact. If returning void looks weird, we should add it to 
> the style guide.


Looks pretty weird. Typically I'd suggest just:

if (foo) {

  Foo();
  return;

}

since that will keep cognitive overhead to a minimum.

-eric

> Other functions are not controversial.




https://reviews.llvm.org/D27872



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to