[PATCH] D83431: [Docs] CodingStandards: for_each is discouraged

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 15:41:12 PDT 2020


lebedev.ri added inline comments.


================
Comment at: llvm/docs/CodingStandards.rst:1305
 
+Usage of ``std::for_each()``/``llvm::for_each()`` functions is discouraged.
+
----------------
nickdesaulniers wrote:
> lebedev.ri wrote:
> > hubert.reinterpretcast wrote:
> > > Even if what's available in the context of the code is a pair of iterators and a callable (and using a range-based for loop would involve extra boilerplate)?
> > That is my understanding, yes.
> it might be useful to provide more information here.
> 
> Use of X is discouraged because ...
> 
> IIUC @dblaikie 's points in https://reviews.llvm.org/D83351#2139727 and https://reviews.llvm.org/D83351#2139861 were that:
> 1. more concise error messages.
> 2. more concise unless an existing function/method/lambda already exists.
> 
> I love functional programming styles, but if an inline lambda definition isn't shorter than a range-for, I agree with @dblaikie and feel a lambda is overkill.
I'm not really sure i understand the point about error message.
Is this better?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83431/new/

https://reviews.llvm.org/D83431





More information about the llvm-commits mailing list