Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!inuxc!iuvax!iucs!bobmon
From: bobmon@iucs.UUCP
Newsgroups: comp.lang.c
Subject: Re: Style [++i vs i++]
Message-ID: <4594@iucs.UUCP>
Date: Wed, 8-Jul-87 23:36:22 EDT
Article-I.D.: iucs.4594
Posted: Wed Jul  8 23:36:22 1987
Date-Received: Sat, 11-Jul-87 15:58:13 EDT
References: <8213@brl-adm.ARPA>
Reply-To: bobmon@iucs.UUCP (Che' Flamingo)
Organization: Camo Flamingo Liberation Affront
Lines: 16

escott@BONNIE.UCI.EDU (Scott Menter) writes:
>
>Actually, I once used a compiler (I don't remember which;  maybe it was the
>os9 level II 6809 compiler) where "i++" and "++i" compiled into slightly
>different code.  Apparently the instruction set had a "post-increment" and
>"pre-decrement" addressing mode (macro-11 has this too, unless I'm mistaken).
>So, if you used pre-auto-decrement ("--i"), or post-auto-increment ("i++"),
>you had the advantage of this addressing mode.  [...]

PDP-11's (Macro-11), 6809's, 6502's and 680x0's all feature post-increment and
pre-decrement addressing modes.  However, since the inc/decrement of the
relevant index register is a side effect of some instruction that's USING that
addressing mode, it isn't obvious to me that the use of that mode is
exceptionally efficient when the side effect is all you want.  Nor is it
obvious to me that all compilers would pick up on this "optimization"
(although I'm sure that some do).