[LLVMdev] local lambdas: request for coding standard clarification/judgement call

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Apr 15 09:32:50 PDT 2014


On Apr 15, 2014, at 9:00 AM, David Majnemer <david.majnemer at gmail.com> wrote:

> Because lambdas can be stateful, they are not simple functions.

Functions are also stateful; C++ isn't a functional language.

> I see lambdas as a shorthand for writing out a functor.

Right.

I think the question here is whether instances of functors should
be treated as functions or variables.

> I would write "Helper" because it is an object of the closure type while the function itself is "operator()".

IMO, it's clearer if callable types (whether they be functions,
member functions, function pointers, or functors) share coding
style.

I think either choice should be clarified in the coding standards.



More information about the llvm-dev mailing list