C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Interceptor Function (preserve stack and all registers)

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Fri, 26 Jul 2024 19:44:44 +0300
On Fri, 26 Jul 2024 at 19:37, Lorand Szollosi via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi,
>
> This is, as I read it, essentially the same thing as function jump in c--, which allows some optimizations and features in Haskell. It’s very much needed in continuation passing / continuation pool style, so slashing it with “how many times do you need it” is an invalid argument: I’d use it all the time. It’d also help in some cases for which we have multiple proposal ideas rotating here already, which is basically multi-return (including return twice, return any number of types - not listed in advance, e.g., types created by third-party template function, etc.). I actually encountered use-cases where we had to wrap a lambda to a std::function<…>, thus have a virtual call, instead of passing a lambda to the function we’d jump to. This slows down inner loops in message processing (HFT) codes.
>
> So yes, even if many people here don’t want full call/cc in C++, the jump-to-function could be a useful step in the direction of handling continuations.

At any rate, it shouldn't be spelled "goto".

Received on 2024-07-26 16:44:58