Infinite loop vs infinite recursion. Are both undefined?
No there is no difference. [basic.progress]p1:
The implementation may assume that any thread will eventually do one of the following:
terminate,
make a call to a library I/O function,
perform an access through a volatile glvalue, or
perform a synchronization operation or an atomic operation.
It doesn't matter how you have your infinite loop; if it doesn't do any of the points above, you get UB. Including the following:
int bar(int cond) {
if (cond == 42) bar(cond);
return 42;
}
bar(some_user_input);
The compiler is allowed to assume that some_user_input
will never be 42.