Date: Thu, 13 Jul 2023 07:17:19 -0700
On Wednesday, 12 July 2023 23:37:50 PDT Lénárd Szolnoki wrote:
> AFAIK current efforts around contracts are doubling down on this design and
> propose contract violation handlers to be replaceable function, similarly
> to to the allocation functions.
Unlike the case of operator new back in pre-C++98 days, the developers making
this requirement are fully aware of the limitations of Windows. It's a
*conscious* choice to allow the override inside of a DLL and not across DLLs.
> Also I strongly disagree for runtime replacement for allocation functions in
> the style of set_terminate() for the simple reason that new and delete
> should better come from the same allocator and and it becomes quite hard to
> guarantee if you replace allocation functions in the middle of your
> program.
Hmm... good point. It's mighty difficult to ensure that it did get replaced
before any allocation because of static initialisation, and replacing the
allocator after you've allocated anything is problematic too.
> AFAIK current efforts around contracts are doubling down on this design and
> propose contract violation handlers to be replaceable function, similarly
> to to the allocation functions.
Unlike the case of operator new back in pre-C++98 days, the developers making
this requirement are fully aware of the limitations of Windows. It's a
*conscious* choice to allow the override inside of a DLL and not across DLLs.
> Also I strongly disagree for runtime replacement for allocation functions in
> the style of set_terminate() for the simple reason that new and delete
> should better come from the same allocator and and it becomes quite hard to
> guarantee if you replace allocation functions in the middle of your
> program.
Hmm... good point. It's mighty difficult to ensure that it did get replaced
before any allocation because of static initialisation, and replacing the
allocator after you've allocated anything is problematic too.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DCAI Cloud Engineering
Received on 2023-07-13 14:17:21