Topic: Other binary and unary shorthand assignment operators
Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Wed, 19 May 2004 01:23:49 +0000 (UTC) Raw View
[...]
> > > 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 ]
Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Sun, 25 Apr 2004 01:43:19 +0000 (UTC) Raw View
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 ]
Author: kuyper@wizard.net (James Kuyper)
Date: Mon, 26 Apr 2004 18:31:13 +0000 (UTC) Raw View
kprateek88@yahoo.com (Prateek R Karandikar) wrote in message news:<607f883e.0404240611.798e2cde@posting.google.com>...
..
> 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 ]
Author: jpotter@falcon.lhup.edu (John Potter)
Date: Mon, 26 Apr 2004 21:32:29 +0000 (UTC) Raw View
On Mon, 26 Apr 2004 18:31:13 +0000 (UTC), kuyper@wizard.net (James
Kuyper) wrote:
> kprateek88@yahoo.com (Prateek R Karandikar) wrote in message news:<607f883e.0404240611.798e2cde@posting.google.com>...
> ..
> > Why aren't there unary shorthand operators ~=, !=, -=, and += ? For
> > example:
The result would be an lvalue.
> -= 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 ]