Message363705
The GCC documentation contains a good example:
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
"""
Another use for __builtin_unreachable is following a call a function that never returns but that is not declared __attribute__((noreturn)), as in this example:
void function_that_never_returns (void);
int g (int c)
{
if (c)
{
return 1;
}
else
{
function_that_never_returns ();
__builtin_unreachable ();
}
}
"""
This example is more explicit than a function which gets an "unexpected" value: such case should use Py_FatalError() if I understand correctly.
By the way, Py_FatalError() should be avoided: it's always better to report the failure to the caller :-) |
|
Date |
User |
Action |
Args |
2020-03-09 08:43:02 | vstinner | set | recipients:
+ vstinner, barry, pitrou, serhiy.storchaka |
2020-03-09 08:43:02 | vstinner | set | messageid: <1583743382.43.0.0875918901595.issue38249@roundup.psfhosted.org> |
2020-03-09 08:43:02 | vstinner | link | issue38249 messages |
2020-03-09 08:43:02 | vstinner | create | |
|