On 2025-09-19 05:23, Bruno Haible wrote:

I like abort() because when it is invoked, it produces
a good message in the shell and a stack trace in the debugger.
Unlike some gcc built-ins, that report a SIGILL (illegal
instruction) in some cases (e.g. wrong use of va_arg).

I prefer to use abort () as a useful signal to the reader that the programmer has examined the program and is definitely unsure whether a bug can occur. This helps the reader distinguish between inadequate compilers (where unreachable () is better) and inadequate programmers (where abort () is better). In this style although there can be judgment calls about which of the two to use, this particular case obviously calls for unreachable (). And the use of unreachable () here doesn't conflict with the utility of abort () to help debug production code.

Thanks for the review; I installed the patch into Coreutils.

Reply via email to