Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: missing ->= operator Message-ID: <16024@smoke.brl.mil> Date: 1 May 91 19:09:22 GMT References: <9104291641.AA00534@dutiaa.tudelft.nl> <1991Apr30.165110.4165@unhd.unh.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 25 In article <1991Apr30.165110.4165@unhd.unh.edu> jwm712@unhd.unh.edu (Jonathan W Miner) writes: >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. No, you're not supposed to be thinking about what code is going to be generated. The main advantage of op= occurs in situations like: p->link->data[BIG_ROOM].flags |= BEEN_HERE; where it would be tedious and error-prone to have to duplicate the LHS as an operand, which would be necessary if the op= form did not exist. There is no such justification for ->=, which seldom would be used in contexts more involved than p = p->next; which is easy enough to code as is. There are some other more technical reasons involving type compatibility, etc. but the above argument shows that it is not worth doing.