Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!wind!naughton From: naughton%wind@Sun.COM (Patrick Naughton) Newsgroups: comp.sys.ibm.pc Subject: Re: TC2.0 bugfree ? Summary: bug in bug report. Message-ID: <86271@sun.uucp> Date: 20 Jan 89 21:32:02 GMT References: <3785@druwy.ATT.COM> Sender: news@sun.uucp Reply-To: naughton@sun.com (Patrick Naughton) Organization: Sun Microsystems, Mountain View Lines: 33 In article <3785@druwy.ATT.COM> rhm@druwy.UUCP (MasseyR) writes: >No bugs in TC2.0 ? > >This small model C program : >sub( cp ) >unsigned char *cp; >{ > int i; > > i = (*cp++ << 8) + *cp++; This is bogus code anyways... Remember that '+' is commutative. you are saying that: i = (*cp++ << 8) + *cp++; is the same as: i = *cp++ + (*cp++ << 8); which it is obviously not. You should use: i = (*cp << 8) + *(cp+1); cp += 2; ...but the code you sent out did look like it showed up a compiler bug, none the less. -Patrick ______________________________________________________________________ Patrick J. Naughton ARPA: naughton@Sun.COM Window Systems Group UUCP: ...!sun!naughton Sun Microsystems, Inc. AT&T: (415) 336 - 1080