Title
Replaceable allocation and deallocation functions in the global module
Status
cd6
Section
10.1 [module.unit]
Submitter
Gabriel dos Reis

Created on 2022-06-17.00:00:00 last changed 27 months ago

Messages

Date: 2022-07-15.19:32:59

Proposed resolution (approved by CWG 2022-07-15):

  1. Change in 6.7.5.5.1 [basic.stc.dynamic.general] paragraph 2 as follows:

    The library provides default definitions for the global allocation and deallocation functions. Some global allocation and deallocation functions are replaceable (17.7.3 [new.delete]) ; these are attached to the global module 10.1 [module.unit]). A C++ program shall provide at most one definition of a replaceable allocation or deallocation function. Any such function definition replaces the default version provided in the library (16.4.5.6 [replacement.functions]). The following allocation and deallocation functions (17.7 [support.dynamic]) are implicitly declared in global scope in each translation unit of a program.
  2. Change in 10.1 [module.unit] bullet 7.2 as follows:

    • If the declaration is ...
    • Otherwise, if the declaration
      • is a replaceable global allocation or deallocation function (17.7.3.2 [new.delete.single], 17.7.3.3 [new.delete.array]), or
      • is a namespace-definition with external linkage, or
      • appears within a linkage-specification (9.11 [dcl.link]),
      it is attached to the global module.
    • Otherwise, ...
Date: 2022-11-20.07:54:16

Proposed resolution (approved by CWG 2022-07-15):

  1. Change in 6.7.5.5.1 [basic.stc.dynamic.general] paragraph 2 as follows:

    The library provides default definitions for the global allocation and deallocation functions. Some global allocation and deallocation functions are replaceable (17.6.3 [new.delete]) ; these are attached to the global module 10.1 [module.unit]). A C++ program shall provide at most one definition of a replaceable allocation or deallocation function. Any such function definition replaces the default version provided in the library (16.4.5.6 [replacement.functions]). The following allocation and deallocation functions (17.6 [support.dynamic]) are implicitly declared in global scope in each translation unit of a program.
  2. Change in 10.1 [module.unit] bullet 7.2 as follows:

    • If the declaration is ...
    • Otherwise, if the declaration
      • is a replaceable global allocation or deallocation function (17.6.3.2 [new.delete.single], 17.6.3.3 [new.delete.array]), or
      • is a namespace-definition with external linkage, or
      • appears within a linkage-specification (9.11 [dcl.link]),
      it is attached to the global module.
    • Otherwise, ...
Date: 2022-11-20.07:54:16

Proposed resolution [SUPERSEDED]:

  1. Change in 6.7.5.5.1 [basic.stc.dynamic.general] paragraph 2 as follows:

    The library provides default definitions for the global allocation and deallocation functions. Some global allocation and deallocation functions are replaceable (17.6.3 [new.delete]). A C++ program shall provide at most one definition of a replaceable allocation or deallocation function. Any such function definition replaces the default version provided in the library (16.4.5.6 [replacement.functions]). The following allocation and deallocation functions (17.6 [support.dynamic]) are implicitly declared in global scope in each translation unit of a program and are attached to the global module (10.1 [module.unit]).
  2. Change in 10.1 [module.unit] bullet 7.2 as follows:

    • If the declaration is ...
    • Otherwise, if the declaration
      • is a replaceable global allocation or deallocation function (17.6.3.2 [new.delete.single], 17.6.3.3 [new.delete.array]), or
      • is a namespace-definition with external linkage, or
      • appears within a linkage-specification (9.11 [dcl.link]),
      it is attached to the global module.
    • Otherwise, ...

Additional notes (June, 2022):

Forwarded to EWG with paper issue 1273, by decision of the CWG chair.

Approved by EWG telecon 2022-07-07.

Date: 2022-07-15.00:00:00

[Accepted at the July, 2022 meeting.]

Subclause 10.1 [module.unit] paragraph 7 implicitly attaches the replaceable global allocation or deallocation functions to the global module. Now that extern "C++" can be used to introduce declarations in the global module, even when in the purview of a named module, the provision seems superfluous.

History
Date User Action Args
2022-08-19 07:54:33adminsetstatus: ready -> cd6
2022-07-15 19:32:59adminsetstatus: review -> ready
2022-07-15 17:43:57adminsetmessages: + msg6885
2022-07-08 19:28:30adminsetmessages: + msg6877
2022-07-08 19:28:30adminsetstatus: open -> review
2022-06-25 06:02:42adminsetmessages: + msg6870
2022-06-17 00:00:00admincreate