I was reading this article and they use the following example to explain undefined behaviour:
// PROGRAM 1
#include <stdio.h>
int f1() { printf ("Geeks"); return 1;}
int f2() { printf ("forGeeks"); return 1;}
int main()
{
int p = f1() + f2();
return 0;
}
However, it seems to be about the order in which subexpressions are evaluated, and according to C standard (Annex J.1), it is an unspecified behaviour and not an undefined behaviour:
Unspecified behavior: The order in which subexpressions are evaluated and the order in which side effects take place, except as specified for the function-call () , &&, || , ? : , and comma operators (6.5)
Since I am very new to reading official specifications, I'm wondering if I did misunderstand the example or the documentation. I know this may seem very pedantic but I'm interested into learning these advanced topics the right way.