Files
2025-10-25 03:02:53 +03:00

1.8 KiB

[dcl.fct.def.replace]

9 Declarations [dcl]

9.6 Function definitions [dcl.fct.def]

9.6.5 Replaceable function definitions [dcl.fct.def.replace]

1

#

Certain functions for which a definition is supplied by the implementation are replaceable.

A C++ program may provide a definition with the signature of a replaceable function, called a replacement function.

The replacement function is used instead of the default version supplied by the implementation.

Such replacement occurs prior to program startup ([basic.def.odr], [basic.start]).

A declaration of the replacement function

shall not be inline,

shall be attached to the global module,

shall have C++ language linkage,

shall have the same return type as the replaceable function, and

if the function is declared in a standard library header, shall be such that it would be valid as a redeclaration of the declaration in that header;

no diagnostic is required.

[Note 1:

The one-definition rule ([basic.def.odr]) applies to the definitions of a replaceable function provided by the program.

The implementation-supplied function definition is an otherwise-unnamed function with no linkage.

— end note]