John R. Hogerhuis wrote:
On Sat, 2005-05-14 at 18:04 -0700, Tom Jennings wrote:
> The answer is: UNDEFINED. What it will print is
UNDEFINED.
> Good old K & R warns you of SIDE EFFECTS, most specifically
> stupid-human assumptions about the order of evaluation.
No, it will not print "UNDEFINED" it will
print something very
well defined.
Not true. It's UNDEFINED. There is no requirement to print
anything. Your compiler writer might have decided that the
compiler should stop at this point. Or it might emit a program
that halts at this point. Or anything else might happen.
You cannot be sure that the same thing will happen on
each run of the program (or of the compiler ...).
Just not defined by the ANSI or ISO folks. It's
defined by
your friendly neighborhood compiler writer.
I agree that it is unlikley that the compiler writer would
have spotted this condition and deliberately decided to
do something nasty and subtle (even though you quite
obviously deserve it for writing that code). But if the
compiler writer did spot it and didn't give you a clear
warning and refuse to produce any object code, then clearly
(s)he has an evil sense of humour, in which case all bets
are off! So you lose either way :-)
Your compiler might have been (partially) coded automatically
by mechanically translating some representation of the C language
(BNF or whatever). So it might well dive off into hyperspace
when it hits an undefined expression.
Antonio
--
---------------
Antonio Carlini arcarlini at
iee.org