CompuServe Messages

Trivia

#: 27660 S7/ProgrammingForum unknown
    24-Jul-86 00:29:48
Sb: #27643-Trivia
Fm: Don Curtis/SYSOP 76703,4321
To: Steve Ahlstrom 76703,2006

This message turned up in search, but its forum couldn’t be identified from the original transcript, so it may not be linked into its thread.

Well, I evaluated it based on operator precedence and associativity. In K&R on page 50, it does in fact state that ++ and — operators can become indetermined and they use the example a[i] = i++; I also made the presumption that the compiler will "fetch" into a register, increment and then store the register value back; therefore, leaving the value unchanged (which is the answer I got with my compiler when I did try it). The same is true for Weird(), if the compiler designer used precedence when the exact value may be indeterminate, the results will be i=3 and j=3 (again, the results I obtained). But, yes, it is dependent on machine and compiler. \ Don