Date: Thu, 4 Apr 2024 17:33:09 +0200
on Thu, 04 Apr 2024 17:17:14 +0200 you (Martin Uecker via Liaison
<liaison_at_[hidden]>) wrote:
> Am Donnerstag, dem 04.04.2024 um 16:58 +0200 schrieb Jₑₙₛ Gustedt via
> Liaison: ...
> >
> > > Why, for heaven's sake, is 'unreachable' a macro in C?
>
> I wanted it to be a function as this is more useful to C as
> well, but somehow I was the only one arguing for it.
>
> >
> > I don't know what the heavens have to do with it, but as you know C
> > has its own objectives and traditions.
> >
> > From memory, there were two objectives:
> >
> > - make the feature testable
>
> This seems unnecessary because it comes with C23.
Its a good thing for
- the transition phase
- C library headers trying to cope with different compilers where some
may provide this (completely, as a predefined macro) and others need
some help
> > - make it easy for C library providers (usually different from
> > compiler implementors) to implement it on top of existing features
> > such as `__builtin_unreachable`.
>
> Library providers could provide a function and a macro
> as the same time as for any other c library function.
ah, right, things pop back into my head, another reason not to have
this as a function is that we were not comfortable to have (and
impose) this as an external library symbol. We could have said
"accessing the function pointer is UB" or something like that, but
just having it as a macro seemed much simpler and in line with what we
already have for other corner cases between language and library.
Thanks
Jₑₙₛ
<liaison_at_[hidden]>) wrote:
> Am Donnerstag, dem 04.04.2024 um 16:58 +0200 schrieb Jₑₙₛ Gustedt via
> Liaison: ...
> >
> > > Why, for heaven's sake, is 'unreachable' a macro in C?
>
> I wanted it to be a function as this is more useful to C as
> well, but somehow I was the only one arguing for it.
>
> >
> > I don't know what the heavens have to do with it, but as you know C
> > has its own objectives and traditions.
> >
> > From memory, there were two objectives:
> >
> > - make the feature testable
>
> This seems unnecessary because it comes with C23.
Its a good thing for
- the transition phase
- C library headers trying to cope with different compilers where some
may provide this (completely, as a predefined macro) and others need
some help
> > - make it easy for C library providers (usually different from
> > compiler implementors) to implement it on top of existing features
> > such as `__builtin_unreachable`.
>
> Library providers could provide a function and a macro
> as the same time as for any other c library function.
ah, right, things pop back into my head, another reason not to have
this as a function is that we were not comfortable to have (and
impose) this as an external library symbol. We could have said
"accessing the function pointer is UB" or something like that, but
just having it as a macro seemed much simpler and in line with what we
already have for other corner cases between language and library.
Thanks
Jₑₙₛ
-- :: ICube :::::::::::::::::::::::::::::: deputy director :: :: Université de Strasbourg :::::::::::::::::::::: ICPS :: :: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus :: :: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 :: :: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
Received on 2024-04-04 15:33:12