int main(void)
{
main();
return 0;
}
wat does the standard says about the above code snippet?
It may run forever, or crash. I don't know if a stack overflow (i.e.
running out of memory in a way that cannot be recovered from) is
considered undefined behavior.
I'm fairly sure it is, since the standard doesn't define what the
behavior is.
I guess i'm used to thinking of UB as something that can at least in
principle be identified by careful examination of the source. that is,
for any given set of inputs ["inputs" including returns from library
functions whose outputs are not fully determined by their inputs - e.g.
malloc returning null or not], a program either does cause UB or
doesn't. stack overflows are a big hole in this, and i think they're
unique.