Path: utzoo!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!pyramid!ncc!alberta!calgary!andrews From: andrews@calgary.UUCP (Keith Andrews) Newsgroups: comp.sys.ibm.pc Subject: Re: TC2.0 bugfree ? Summary: Again, not a bug Message-ID: <537@cs-spool.calgary.UUCP> Date: 20 Jan 89 16:30:12 GMT References: <3785@druwy.ATT.COM> Organization: U. of Calgary, Calgary, Ab. Lines: 36 In article <3785@druwy.ATT.COM>, rhm@druwy.ATT.COM (Roger Massey) writes: > No bugs in TC2.0 ? > > This small model C program : > > sub( cp ) > unsigned char *cp; > { > int i; > > i = (*cp++ << 8) + *cp++; > } > *** Omitted code showing that "cp" gets incremented twice at end of generate code instead of after each reference *** > > Roger Massey > AT&T Denver Sorry, this isn't a bug. The order of evaluation of the ++ operators in an expression is not guaranteed. As evidence, this is what lint has to say about the above code fragment: Script started on Fri Jan 20 09:21:51 1989 1: lint foo.c foo.c(6): warning: cp evaluation order undefined foo.c(6): warning: i set but not used in function sub sub defined( foo.c(3) ), but never used 2: ^D script done on Fri Jan 20 09:22:04 1989 Nevertheless, Turbo C likes to make noises about practically everything else, I wonder they don't issue warnings about this? Keith Andrews andrews@cpsc.UCalgary.CA