Hi,
On Wed, Jan 10 2024, Jason Merrill via Gcc wrote:
> What formatting style do we want for non-trivial lambdas in GCC sources?
> I'm thinking the most consistent choice would be
>
> auto l = [&] (parms) // space between ] (
> { // brace on new line, indented two spaces
> return stuff;
> };
>
> By default, recent emacs lines up the { with the previous line, like an
> in-class function definition; I talked it into the above indentation with
>
> (defun lambda-offset (elem)
> (if (assq 'inline-open c-syntactic-context) '+ 0))
> (add-to-hook 'c++-mode-hook '(c-set-offset 'inlambda 'lambda-offset))
Is this really add-to-hook and not add-hook?
Thanks!
Martin
>
> I think we probably want the same formatting for lambdas in function
> argument lists, e.g.
>
> algorithm ([] (parms)
> {
> return foo;
> });
>
> Any other opinions?
>
> Jason