C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::recurse

From: Jeremy Rifkin <rifkin.jer_at_[hidden]>
Date: Sun, 18 May 2025 14:54:20 -0500
> Put the embedded assembler at the very beginning of the lambda before
anything might alter the value of RDI.

Writing that would be a pain, so presumably you mean the compiler could add
that for you. But here you were talking about doing it without compiler
magic ;)

And no one wants unconditional overhead just to support something like
std::recurse.

> you can just have an
'explicit this' parameter to the lambda

In which case you'd never use std::recurse.

Jeremy


On Sun, May 18, 2025 at 2:45 PM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:

> On Sun, May 18, 2025 at 8:41 PM Jeremy Rifkin wrote:
> >
> > > well on x86_64 when a member function is invoked, the
> > 'this' pointer is placed in the RDI
> >
> > By the time std::recurse is called it could be anywhere (or nowhere).
>
>
> Put the embedded assembler at the very beginning of the lambda before
> anything might alter the value of RDI.
>
>
> > Keep in mind lambdas operator()'s might be static, too, and normal
> functions won't have `this` pointers.
>
>
> Actually as Pavel said earlier in this thread, you can just have an
> 'explicit this' parameter to the lambda.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2025-05-18 19:54:34