C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Other binary and unary shorthand assignment operators

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Prateek R Karandikar
Guest





PostPosted: Sun Apr 25, 2004 1:43 am    Post subject: Other binary and unary shorthand assignment operators Reply with quote



Why aren't there shorthand &&= and ||= operators? Is it related to the
short circuit evaluation and sequence points?

Why aren't there unary shorthand operators ~=, !=, -=, and += ? For
example:

x = ~x;

could have become

~= x;

As with binary shorthand operators, this would have been more concise,
less error-prone, and potentially more efficient. ( Imagine if x was a
matrix and ~ signified inversion. Even without ~=, one could have used
compositors, but that is not the point here.)

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]

Back to top
James Kuyper
Guest





PostPosted: Mon Apr 26, 2004 6:31 pm    Post subject: Re: Other binary and unary shorthand assignment operators Reply with quote



[email]kprateek88 (AT) yahoo (DOT) com[/email] (Prateek R Karandikar) wrote in message news:<607f883e.0404240611.798e2cde (AT) posting (DOT) google.com>...
...
Quote:
Why aren't there unary shorthand operators ~=, !=, -=, and += ? For
example:


-= and += are already in use for the binary operators.

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]


Back to top
John Potter
Guest





PostPosted: Mon Apr 26, 2004 9:32 pm    Post subject: Re: Other binary and unary shorthand assignment operators Reply with quote



On Mon, 26 Apr 2004 18:31:13 +0000 (UTC), [email]kuyper (AT) wizard (DOT) net[/email] (James
Kuyper) wrote:

Quote:
kprateek88 (AT) yahoo (DOT) com (Prateek R Karandikar) wrote in message news:<607f883e.0404240611.798e2cde (AT) posting (DOT) google.com>...
..
Why aren't there unary shorthand operators ~=, !=, -=, and += ? For
example:

The result would be an lvalue.

Quote:
-= and += are already in use for the binary operators.

What's the problem?

z = y - - x; // - is overloaded
y -= -= x; // -= is now overloaded

John

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]


Back to top
Prateek R Karandikar
Guest





PostPosted: Wed May 19, 2004 1:23 am    Post subject: Re: Other binary and unary shorthand assignment operators Reply with quote

[...]
Quote:
Why aren't there unary shorthand operators ~=, !=, -=, and += ? For
example:

The result would be an lvalue.
[...]


Even the result of all the built-in assignment operators, including
the shorthand ones, are lvalues. So what's the problem with ~= etc?

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.