C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] unreachable control flow

From: Aaron Ballman <aaron_at_[hidden]>
Date: Mon, 17 May 2021 09:08:42 -0400
On Mon, May 17, 2021 at 8:47 AM Jₑₙₛ Gustedt <jens.gustedt_at_[hidden]> wrote:
>
> Aaron,
>
> on Mon, 17 May 2021 07:01:33 -0400 you (Aaron Ballman
> <aaron_at_[hidden]>) wrote:
>
> > On Sun, May 16, 2021 at 6:13 AM Jₑₙₛ Gustedt via Liaison
> > <liaison_at_[hidden]> wrote:
> > >
> > > Hello,
> > > it seems that C++ has integrated
> > >
> > > https://wg21.link/p0627
> > >
> > > into C++20. This provides a pseudo-function `unreachable` where a
> > > call indicates that the whole path in the control flow that reaches
> > > it can never be taken.
> > >
> > > Is there interest / attempt / opposition of porting this feature to
> > > C?
> >
> > Personally, I'm in favor of the idea -- the proposed functionality
> > applies in C with the same general rationale (alongside similar C
> > functionality as _Noreturn and assert), and it would be handy to add
> > this functionality to C's toolbox.
>
> Great, so far the only reactions that I have been seeing here are
> favorable. In contrast to that, the state of the proposal is somehow
> unknown? Is there a way to know better where this is stuck, currently?

WG21 tracks all of their papers using GitHub issues so that you can
see the state of a given proposal. According to the issue for this
paper (https://github.com/cplusplus/papers/issues/275), it looks like
this was last seen in Prague 2020 and needs additional revision. To
see what feedback was given in Prague, you can check out the WG21 wiki
(it uses the same password as the SG22 monthly meeting Zoom password):
https://wiki.edg.com/bin/view/Wg21prague/ (likely somewhere under the
Library Working Group heading as they were the last group to see this
according to the GitHub issue).

~Aaron

> If I see correctly, for the design of such features there are
> basically two alternatives
>
> - mark the path in the control flow as `unreachable` (as a pseudo
> function or as an attribute)
> - have a macro with condition such as `assume`.
>
> I personally see the advantages and disadvantages of both. Also, they
> are not really far apart from each other and each can easily be
> emulated by the other.
>
> If `unreachable` would be relatively advanced in the process for C++,
> I would not even like to spend too much time on `assume`;
> `unreachable` has the advantage of being implemented in many compilers
> with just other names, also in C mode.
>
> If not, indeed we could start thinking about a common design of a
> feature.
>
> Thanks
> Jₑₙₛ
>
> --
> :: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
> :: ::::::::::::::: office Strasbourg : +33 368854536 ::
> :: :::::::::::::::::::::: gsm France : +33 651400183 ::
> :: ::::::::::::::: gsm international : +49 15737185122 ::
> :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Received on 2021-05-17 08:09:18