Precedence Question - (nf)
pedz at smu.UUCP
pedz at smu.UUCP
Fri Feb 10 14:08:33 AEST 1984
#N:smu:13800001:000:747
smu!pedz Feb 9 00:17:00 1984
I have a small question for you C people. We were writting a
compiler for C and came accross this interesting problem. Is the
statement:
cat = foo ? fu = bar : mouse;
legal? Specifically the assignment operator (which has lower
precedence than the ?: thing) between the ? and the :. If it
is legal, at what point does bar get assigned to fu, before or
after the assignment to cat? If after (since it has lower
precedence) then I would assume cat is assign the value of fu, after
which fu is assigned the value of bar. Right or wrong. Note, the
VAX C compiler accepts it and its actions can easily be determined.
That is not the question. The question is "according to K & R ...".
Respond vai mail and I will post.
Perry
parsec!smu!pedz
More information about the Comp.lang.c
mailing list