 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Prateek R Karandikar Guest
|
Posted: Sun Apr 25, 2004 1:43 am Post subject: Other binary and unary shorthand assignment operators |
|
|
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
|
Posted: Mon Apr 26, 2004 6:31 pm Post subject: Re: Other binary and unary shorthand assignment operators |
|
|
[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
|
Posted: Mon Apr 26, 2004 9:32 pm Post subject: Re: Other binary and unary shorthand assignment operators |
|
|
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
|
Posted: Wed May 19, 2004 1:23 am Post subject: Re: Other binary and unary shorthand assignment operators |
|
|
[...]
| 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 |
|
 |
|
|
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
|
|