Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site dataio.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!tektronix!uw-beaver!uw-june!entropy!dataio!bright From: bright@dataio.UUCP (Walter Bright) Newsgroups: net.lang.c Subject: Re: C programming style Message-ID: <723@dataio.UUCP> Date: Mon, 22-Jul-85 05:51:11 EDT Article-I.D.: dataio.723 Posted: Mon Jul 22 05:51:11 1985 Date-Received: Thu, 25-Jul-85 08:11:53 EDT Reply-To: bright@dataio.UUCP (Walter Bright) Organization: Data I/O Corp., Redmond WA Lines: 16 >In article <186@drivax.UUCP> braun@drivax.UUCP (Karl Braun) writes: >The comment regarding the efficiency of the >produced code is probably applicable to most compilers, but academically, any >reasonable optimizer should optimize 'i = i + 1' to equivalant code. Most Pascal and Fortran compilers will replace i=i+1 with i+=1 internally. C compilers, however, usually don't bother because the i+=1 and ++i forms are available, and the assumption is that they would have been used. These comments also apply to all the op= forms in C. Some C compiler trivia: Since (i+=1) is exactly equivalent to (++i), most C compilers immediately translate (++i) into (i+=1), and internally use the second one from then on. Also, (i++) is usually internally translated to (i+=1) if the result of the expression is not used. These kinds of conversions make life easier for the code generator.