Skip to content

Consider unifying existing practices of don't-call functions #3888

@achabense

Description

@achabense

Currently there are (at least) 4 special functions that use unconditional abort/terminate to express that, they are not supposed to be called at runtime, but have to be defined for some reasons:

List

<functional>:
_Func_impl(_no_alloc)::_Target_type when !_HAS_STATIC_RTTI:

_CSTD abort();

_CSTD abort();

<future>:
_Fake_no_copy_callable_adapter's copy constructor:
_STD terminate(); // Very Bad Things

<xutility>:
projected(_Projected_impl)::operator *:
_CSTD abort();

It's desirable to make them distinct from common noreturn functions, which are to be called to get noreturn behavior purposefully. Further, I think it's also desirable to do this in a unified way. Some questions are:

  1. Are the intents of these abort/terminate exactly indentical(Nothing more than should not be called at runtime)?
  2. Is _Fake_no_copy_callable_adapter's usage of terminate replaceable with abort?
  3. Is it desirable to replace direct usage of abort with a specific utility(like a _MACRO()), to express the intent more clearly?
  4. Is "abort" preferrable behavior in these conditions? Are there other candidates for it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSomething can be improvedfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions