P
Peter Nilsson
Christopher said:]Unless you are using a C99 compiler, you must return a value from
main().
It's not mandatory un C90, just desirable.
I suppose that's strictly correct, but it's probably safe to assume
that a reasonable host environment will attempt to use the termination
status of main.
It's not safe to assume that, but it is something to consider.
I would think that the chances of UB on a hosted
implentation would be rather high.
The standard doesn't define what the host does with an undefined
status.
But it doesn't define what the host does with a successful status
either.
Hence, if one is 'UB', so is the other!
Pragmatically though, programmers who leave out the return value from
main under C89 are risking future problems in cases where their program
is used in higher level script (e.g. shell script). Such scripting
languages may terminate on spurious error signals from the program.
So 'UB' in this case is probably better phrased as undesirable
behaviour,
rather than undefined.