C++ Logo

std-proposals

Advanced search

Re: [std-proposals] alx-0088r0 - noreturn can't return

From: Alejandro Colomar <une+cxx_std-proposals_at_[hidden]>
Date: Sun, 15 Feb 2026 23:43:41 +0100
Hi Sebastian,

On 2026-02-15T22:48:57+0100, Sebastian Wittmeier via Std-Proposals wrote:
> I used macros for logging in production code some years ago, where each function had its return statements replaced, so that the return and the return value could be logged, if needed.

Could you please show some code to help understand how that looks like?

> In such code bases the noreturn functions can use a different macro of course (e.g. an unreachable macro at the function end, which logs and terminates the program).
>
> It can be solved, but it would have to be special-cased in such codebases.

Cheers,
Alex

>
> -----Ursprüngliche Nachricht-----
> Von:Alejandro Colomar <une+cxx_std-proposals_at_[hidden]>
> Gesendet:So 15.02.2026 22:48
> Betreff:Re: [std-proposals] alx-0088r0 - noreturn can‘t return
> Anlage:signature.asc
> An:Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]>;
> CC:Sebastian Wittmeier <wittmeier_at_[hidden]>;
> Hi Sebastian,
>
> On 2026-02-15T21:49:43+0100, Sebastian Wittmeier via Std-Proposals wrote:
> > 1)
> >
> > Having a comma at the end of a list also makes no sense.
> >
> > But it simplifies additions of additional entries/lines, automatic code generation, copy&paste, etc.
> >
> > a return statement could be created even for noreturn functions by
> > macros, e.g. some macros create log messages for entering or leaving
> > functions.
>
> Could you please show a real case where a macro contains a return
> statement and is used within a [[noreturn]] function?
>
> Or if that's too difficult, could you please envision some code that
> does it and makes some sense?
>
> >
> > 2)
> >
> > The return type is not part of the function signature for overloading,
> > but it is part of the function type. Functions with different return
> > types are not ABI compatible either.
> >
> > So a noreturn function could have a return type, but no return
> > instruction?
>
> Indeed; that's what they are. They are functions that have a return
> type for compatibility reasons (e.g., callbacks), but which decide to
> never return, for $reasons.
>
>
> Have a lovely night!
> Alex
>
> --
> <https://www.alejandro-colomar.es>

> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals


-- 
<https://www.alejandro-colomar.es>

Received on 2026-02-15 22:44:31