C++ Logo

std-proposals

Advanced search

Re: [std-proposals] set_new_handler extension

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 12 Feb 2023 09:08:22 -0800
On Sunday, 12 February 2023 08:57:37 PST Jason McKesson via Std-Proposals
wrote:
> It should also be noted that the standard explicitly says that "A C++
> program shall provide at most one
> definition of a replaceable allocation or deallocation function." So
> if you replace it, and include a DLL that also replaces it... what is
> supposed to happen?

It's actually out of scope because the standard doesn't talk about DLLs.

> By default, this is ill-formed and a diagnostic is required. But this
> is dynamic linking; we're well past the stage in the practical process
> of compilation where a "diagnostic" is possible. You could have a
> dynamic linking error if the two programs disagree on what allocation
> functions to use.

When performing the compile-time linking, the duplication of such functions
can be and is detected, with an error output. So that complies with the
requirement from the standard.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-02-12 17:08:24