Path: utzoo!attcan!uunet!snorkelwacker!usc!cs.utexas.edu!ut-emx!walt.cc.utexas.edu!mayoff From: mayoff@walt.cc.utexas.edu (Rob "The" Mayoff) Newsgroups: comp.lang.c Subject: Re: New assignment operator ->= ? Message-ID: <24810@ut-emx.UUCP> Date: 20 Feb 90 18:02:14 GMT References: <24707@ut-emx.UUCP> <625@wzv.win.tue.nl> Sender: news@ut-emx.UUCP Reply-To: mayoff@walt.cc.utexas.edu (Rob "The" Mayoff) Organization: Talisman & The University of Texas at Austin Lines: 37 In an article entitled New assignment operator ->= ?, wietse@wzv.win.tue.nl (Wietse Z. Venema) enlightens us with: >Don't forget the .= operator. Unfortunately, such language features would >prohibit other language perversions such as: > > a ^+= b <-> a ^= a += b <-> a = a ^ a + b > p ->= q <-> p -= p >= q <-> p = p - p > q > While I am sure you at least partially joking, it seems that you dislike my suggestion. Let me respond: The .= operator would probably never be used. I don't think a structure can be a member of itself, and I don't think a union can be a member of itself, so you can't assign a structure variable to a member of itself. On the other hand, a pointer to a structure can be a member of that same structure, and assigning that member of the structure to a variable pointing to that structure is a logical, I might even say common, operation. While it would not cause the compiler to generate less instructions, as += might (at least in non-optimizing compilers), it is shorter to type and no less readable (at least, no less readable than a+=b, etc). Furthermore, the += operator, and its siblings give the idea of "incrementing" the variable, or scaling it, etc. To me, incrementing a numerical variable seems analogous to advancing a pointer to a linked list along that list. So far, I've gotten five positive responses. I also got one response that pointed out that -> is not exactly a binary operation, since the right-hand identifier indicates a structure element, not a variable. And, of course, the response I am replying to. Anyone else have an opinion on this? Also, can anyone (and I'm sure someone can) tell me how to contact the ANSI C committee? __ /\_\ Rob Mayoff \/_/ mayoff@ccwf.cc.utexas.edu