Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!srcsip!sip7!colburn From: colburn@sip7.SRC.Honeywell.COM (Mark H. Colburn) Newsgroups: comp.sys.ibm.pc Subject: Re: TC2.0 bugfree ? Message-ID: <16344@srcsip.UUCP> Date: 7 Feb 89 17:23:34 GMT References: <3785@druwy.ATT.COM> Sender: news@src.honeywell.COM Reply-To: colburn@sip7.UUCP (Mark H. Colburn) Organization: Honeywell Systems & Research Center, Camden, MN Lines: 30 In article <3785@druwy.ATT.COM> rhm@druwy.UUCP (MasseyR) writes: > i = (*cp++ << 8) + *cp++; >note that si (i.e. cp) is not incremented between references >but instead after both references. Note, that this is not necesarily incorrect. It is undefined to include two operations with side effects which reference the same variable. Among other things it is bad coding style. Worse, it provides unexpected results on a number of compilers. The code would be better written: i = (*cp << 8) + *(cp + 1); cp += 2; One of the classic examples of side effects is given below: i = 10; i++ = 10 * i++; what is the value of I going to be? 111? 120? Remember that C may entirely reorder your expression before evaluating it. You shouldn't write code like that. Mark H. Colburn MN65-2300 colburn@SRC.Honeywell.COM Systems Administration and Support Honeywell Systems & Research Center