Skip to content

DE002 Rename make_unique/shared_default_init to make_unique/shared_nonvalue_init #2

@wg21bot

Description

@wg21bot

P1020R1 ((https://wg21.link/p1020r1) proposed some helper functions
for smart pointers that do not necessarily initialize values.
Providing better performance but bring more risk.

However, the technical term "default initialization" used in their name
does not always initialize (as value initialization does).
Therefore, it is highly confusing for programmers
to call an ordinary function
make_unique_default_init()
make_shared_default_init()
allocate_shared_default_init()

If you ask what is safer:
make_shared()
or
make_shared_default_init()
almost every programmer says the latter.

For this reason, the more risky version should
have a name that demonstrates the risk rather than giving a false sense
of safety.

Proposed change:
We strongly request to rename them to
make_unique_nonvalue_init()
make_shared_nonvalue_init()
allocate_shared_nonvalue_init()
(with or without a _ between non and value).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions