https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110437
--- Comment #12 from Jan Žižka <jan.zizka at nokia dot com> ---
(In reply to Xi Ruoyao from comment #11)
> is perfectly legal if the caller doesn't pass anything other than 1 or 42 to
> f. So we cannot just reject it at the compile time, we can only issue a
> warning.
True that, still this doesn't make it sound software implementation :-)
Another example pointed out by one colleague of mine:
int f(int a)
{
if (a == 1)
exit(0);
else
return 0xbeef;
}
> And generally there is no way to determine if an "unsupported" value is
> passed to f at compile time because doing so will need to solve the halting
> problem.
That is true :-) but from software implementation if you reuse such a function
or it is a library I'd personally disallow this as this is bad coding. But this
will be opinionated so better not to dive to such a rabbit hole.
Thanks for comments.