Path: utzoo!attcan!sobmips!uunet!samsung!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!purdue!bu-cs!mirror!ima!esegue!johnl From: johnl@esegue.segue.boston.ma.us (John R. Levine) Newsgroups: comp.sys.ibm.pc Subject: Re: Turbo C far pointers Message-ID: <1989Nov16.155005.6689@esegue.segue.boston.ma.us> Date: 16 Nov 89 15:50:05 GMT References: <4037@cs.yale.edu> <579@gmuvax2.gmu.edu> Reply-To: johnl@esegue.segue.boston.ma.us (John R. Levine) Organization: Segue Software, Cambridge MA Lines: 17 In article <579@gmuvax2.gmu.edu> 2179ak@gmuvax2.UUCP (JDPorter) writes: >>That's ridiculous. *(A+1), A[1], and 1[A] all produce exactly the same code. >*(A+1) does NOT produce the same code as A[1]. (not for MSC, anyway.) Congratulations, you've found an optimization bug in MSC. In Turbo, assuming that A is an int * passed as an argument, they all generate these two instructions (picked verbatim from the generated .ASM): mov bx,word ptr [bp+4] mov ax,word ptr [bx+2] Can we stop arguing about this now? -- John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650 johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl "Now, we are all jelly doughnuts."