C++ Logo

std-proposals

Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 13 Apr 2026 11:35:30 -0700
On Monday, 13 April 2026 11:08:20 Pacific Daylight Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> On Monday, April 13, 2026, Thiago Macieira wrote:
> > Since this can only aspire to become a compiler extension, it doesn't need
> > to
> > work everywhere. It just needs to work where you need it to work.
>
> I don't see why you're thinking that way.

Because there's no use-case possible for it that would apply in the Standard's
abstract machine. You *cannot* replace a function.

> Personally I'd use it for debugging, logging and changing the behaviour of
> a pre-compiled DLL or SO file.
>
> Another guy 2 years ago said he would find it very useful for interfacing
> C++ code with Haskell.

I don't doubt you'd find it useful. I don't doubt others may find it too.

I just don't think it has to be in the Standard. __attribute__((interrupt))
isn't in the Standard and doesn't have to be. Neither are
__attribute__((zero_call_used_regs)), no_callee_saved_registers,
no_caller_saved_registers, etc.

> I'll start this off though by making it an extension to GNU g++, and take
> it from there.

Right.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-04-13 18:35:38