Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!think!ames!oliveb!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Style [++i vs i++] Message-ID: <23576@sun.uucp> Date: Wed, 15-Jul-87 18:56:18 EDT Article-I.D.: sun.23576 Posted: Wed Jul 15 18:56:18 1987 Date-Received: Sat, 18-Jul-87 01:39:58 EDT References: <17310@amdcad.AMD.COM> <246@hubcap.UUCP> <259@hwee.UUCP> Sender: news@sun.uucp Lines: 21 > >There is no reason a compiler needs to generate code differently for i++; > >and ++i; if that is the entire expression (and statement). > > > > As I remember the original PDP-11 C compiler did treat the two cases > differently. This was because the PDP had an autoincrement addressing > mode... This made i++ more efficient that ++i since it could make use > of this mode. People seem to be missing the point completely. The addressing modes are irrelevant when the value of the expression isn't being used! There is no sequence of code generated for the statement i++; that is not also a valid sequence of code for the statement ++i; Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com