3 ms·
No, it's not undefined behavior. Only the status returned to the host environment is undefined. (And in C99 and later, the status is 0.) As for your example:
by _kst_ 5y ago
No, it's not undefined behavior. Only the status returned to the host environment is undefined. (And in C99 and later, the status is 0.)
As for your example:
int foo(int x) { if (x >= 0) return 123; if (x < 0) return 456; }
that has undefined behavior only if the caller uses the value. (That's to cater to ancient C code written before the void type was introduced.)