Date: Sun, 15 Feb 2026 22:48:57 +0100
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.
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.
-----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>
Received on 2026-02-15 22:06:02
