missing ->= operator

Jonathan W Miner jwm712 at unhd.unh.edu
Wed May 1 02:51:10 AEST 1991


In article <9104291641.AA00534 at dutiaa.tudelft.nl> schuller at DUTIAA.TUDELFT.NL (Schuller Schuller Oijen) writes:
>Hi all,
>recently I've been doing a lot of C pointer programming and I came upon
>a missing feature in C. Suppose you have this struct called mygod :
> [code deleted]
>What you do quite often is : mygodptr = mygodptr->next;
>Now C has all these wonderful operators : a += 7, g &= 0xf, etc, etc.
>But the ->= operator is missing! You cannot do mygodptr ->= next; !
>All of you who want to fill this gap, please react. Flames to /dev/null.
>Bye! Hildo Biersma, schuller at dutiad.tudelft.nl

It is my opinion that the +=, &= etc operators were implemented on systems,
such as DEC VAX that has two operand instructions.  Although it would
be nice to have a ->=, it would be a programmer convenience, and it would
still be compiled into the same code as p = p->next.  

Now for my question: how do the below operators compare speedwise?


    C                     pseudo VAX code

    a++;                  inc a;

    a += 1;               add2 1,a;

    a = a + 1;            add3 1,a,a;


Jon.



-- 
Jonathan Miner        | I won't speak for UNH, and UNH does not 
jwm712 at unhd.unh.edu   | speak for me, but they'll charge me anyway! 
(603)868-3416         | Hacking to graduate this May!
Moving soon to miner at mervax.sanders.com  (I think?!)



More information about the Comp.lang.c mailing list