Article View: comp.sys.mac
Article #14414LSC ++ and -- operators
From: clubmac
Date: Wed, 11 Feb 1987 03:55
Date: Wed, 11 Feb 1987 03:55
45 lines
1245 bytes
1245 bytes
Here is something I found on a local BBS...
I just discovered that the postfix ++ -- operators are less efficient than
prefix ++ and --.
if you have a block like :
{
register char *a,*b;
*(a++) = *(b++);
}
it translates to :
movea.l A4,A0 ; A4 holds b
movea.l A3,A1 ; A1 holds a
move.b (A0),(A1)
moveq #1,A3
moveq #1,A4
but if you have a block like :
{
register char *a,*b;
*(a) = *(b);
a++;b++;
}
it translates to :
move.b (A4),(A3)
moveq #1,A3
moveq #1,A4
You dont get the above problem with prefix ++ and --.
MORAL : Dont assume - disassemble your code !
John Lim
---------------
Anybody know anything about this?
Jason Haines
Technical Details
Message-ID:
<654@runx.OZ>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!munnari!otc!metro!ipso!runx!clubmacShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!munnari!otc!metro!ipso!runx!clubmac From: clubmac@runx.UUCP Newsgroups: comp.sys.mac Subject: LSC ++ and -- operators Message-ID: <654@runx.OZ> Date: Tue, 10-Feb-87 22:55:25 EST Article-I.D.: runx.654 Posted: Tue Feb 10 22:55:25 1987 Date-Received: Fri, 13-Feb-87 05:43:05 EST Organization: RUNX Un*x Timeshare. Sydney, Australia. Lines: 44