Topic: Proposal: introduce logical xor (^^) operator


Author: =?UTF-8?Q?Daniel_Fru=C5=BCy=C5=84ski?= <daniel.fruzynski@googlemail.com>
Date: Tue, 22 Oct 2013 10:39:49 -0700 (PDT)
Raw View
------=_Part_257_24047771.1382463589695
Content-Type: text/plain; charset=ISO-8859-1

Most bitwise operators in C/C++ have their logical counterparts. However
there is one exception: bitwise xor operator (^) does not have its logical
counterpart. Therefore I propose to introduce logical xor operator: ^^.
Personally I needed operator like this few times, and had to write some
extra code to achieve the same effect in my code.

What do you think about this?

Regards,
Daniel

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_257_24047771.1382463589695
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Most bitwise operators in C/C++ have their logical counter=
parts. However there is one exception: bitwise xor operator (^) does not ha=
ve its logical counterpart. Therefore I propose to introduce logical xor op=
erator: ^^. Personally I needed operator like this few times, and had to wr=
ite some extra code to achieve the same effect in my code.<br><br>What do y=
ou think about this?<br><br>Regards,<br>Daniel<br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_257_24047771.1382463589695--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Tue, 22 Oct 2013 20:44:19 +0300
Raw View
--001a11c286884b128904e957f3c8
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 22 October 2013 20:39, Daniel Fru=C5=BCy=C5=84ski
<daniel.fruzynski@googlemail.com>wrote:

> Most bitwise operators in C/C++ have their logical counterparts. However
> there is one exception: bitwise xor operator (^) does not have its logica=
l
> counterpart. Therefore I propose to introduce logical xor operator: ^^.
> Personally I needed operator like this few times, and had to write some
> extra code to achieve the same effect in my code.
>
> What do you think about this?
>
>
Doesn't operator!=3D do what you want?

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--001a11c286884b128904e957f3c8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 22 October 2013 20:39, Daniel Fru=C5=BCy=C5=84ski <span dir=3D"l=
tr">&lt;<a href=3D"mailto:daniel.fruzynski@googlemail.com" target=3D"_blank=
">daniel.fruzynski@googlemail.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">Most bitwise operators in C=
/C++ have their logical counterparts. However there is one exception: bitwi=
se xor operator (^) does not have its logical counterpart. Therefore I prop=
ose to introduce logical xor operator: ^^. Personally I needed operator lik=
e this few times, and had to write some extra code to achieve the same effe=
ct in my code.<br>
<br>What do you think about this?<br><br></div></blockquote><div><br></div>=
<div>Doesn&#39;t operator!=3D do what you want? <br></div></div><br></div><=
/div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c286884b128904e957f3c8--

.


Author: Johannes Schaub <schaub.johannes@googlemail.com>
Date: Tue, 22 Oct 2013 19:56:25 +0200
Raw View
2013/10/22 Ville Voutilainen <ville.voutilainen@gmail.com>:
>
>
>
> On 22 October 2013 20:39, Daniel Fru=C5=BCy=C5=84ski <daniel.fruzynski@go=
oglemail.com>
> wrote:
>>
>> Most bitwise operators in C/C++ have their logical counterparts. However
>> there is one exception: bitwise xor operator (^) does not have its logic=
al
>> counterpart. Therefore I propose to introduce logical xor operator: ^^.
>> Personally I needed operator like this few times, and had to write some
>> extra code to achieve the same effect in my code.
>>
>> What do you think about this?
>>
>
> Doesn't operator!=3D do what you want?
>

I would expect that for logical xor, "1 logxor 2" is false (just like
"1 && 2" works and converts the operands to bool, I would expect the
same for logxor). Whereas with "!=3D", it yields true.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: "Billy O'Neal" <billy.oneal@gmail.com>
Date: Tue, 22 Oct 2013 11:00:48 -0700
Raw View
--001a11c2529e9882ba04e95830e7
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Isn't there potential for confusion where users think ^^ means
exponentiation? This is already confusing for many users.

Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Tue, Oct 22, 2013 at 10:56 AM, Johannes Schaub <
schaub.johannes@googlemail.com> wrote:

> 2013/10/22 Ville Voutilainen <ville.voutilainen@gmail.com>:
> >
> >
> >
> > On 22 October 2013 20:39, Daniel Fru=C5=BCy=C5=84ski <
> daniel.fruzynski@googlemail.com>
> > wrote:
> >>
> >> Most bitwise operators in C/C++ have their logical counterparts. Howev=
er
> >> there is one exception: bitwise xor operator (^) does not have its
> logical
> >> counterpart. Therefore I propose to introduce logical xor operator: ^^=
..
> >> Personally I needed operator like this few times, and had to write som=
e
> >> extra code to achieve the same effect in my code.
> >>
> >> What do you think about this?
> >>
> >
> > Doesn't operator!=3D do what you want?
> >
>
> I would expect that for logical xor, "1 logxor 2" is false (just like
> "1 && 2" works and converts the operands to bool, I would expect the
> same for logxor). Whereas with "!=3D", it yields true.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--001a11c2529e9882ba04e95830e7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Isn&#39;t there potential for confusion where users think =
^^ means exponentiation? This is already confusing for many users.</div><di=
v class=3D"gmail_extra"><br clear=3D"all"><div><div dir=3D"ltr"><div>Billy =
O&#39;Neal</div>

<div><a href=3D"https://bitbucket.org/BillyONeal/" target=3D"_blank">https:=
//github.com/BillyONeal/</a></div><div><a href=3D"http://stackoverflow.com/=
users/82320/billy-oneal" target=3D"_blank">http://stackoverflow.com/users/8=
2320/billy-oneal</a></div>

<div>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Tue, Oct 22, 2013 at 10:56 AM, Johann=
es Schaub <span dir=3D"ltr">&lt;<a href=3D"mailto:schaub.johannes@googlemai=
l.com" target=3D"_blank">schaub.johannes@googlemail.com</a>&gt;</span> wrot=
e:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">2013/10/22 Ville Voutilainen &lt;<a href=3D"=
mailto:ville.voutilainen@gmail.com">ville.voutilainen@gmail.com</a>&gt;:<br=
>

<div class=3D"im">&gt;<br>
&gt;<br>
&gt;<br>
&gt; On 22 October 2013 20:39, Daniel Fru=C5=BCy=C5=84ski &lt;<a href=3D"ma=
ilto:daniel.fruzynski@googlemail.com">daniel.fruzynski@googlemail.com</a>&g=
t;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Most bitwise operators in C/C++ have their logical counterparts. H=
owever<br>
&gt;&gt; there is one exception: bitwise xor operator (^) does not have its=
 logical<br>
&gt;&gt; counterpart. Therefore I propose to introduce logical xor operator=
: ^^.<br>
&gt;&gt; Personally I needed operator like this few times, and had to write=
 some<br>
&gt;&gt; extra code to achieve the same effect in my code.<br>
&gt;&gt;<br>
&gt;&gt; What do you think about this?<br>
&gt;&gt;<br>
&gt;<br>
&gt; Doesn&#39;t operator!=3D do what you want?<br>
&gt;<br>
<br>
</div>I would expect that for logical xor, &quot;1 logxor 2&quot; is false =
(just like<br>
&quot;1 &amp;&amp; 2&quot; works and converts the operands to bool, I would=
 expect the<br>
same for logxor). Whereas with &quot;!=3D&quot;, it yields true.<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
<br>
---<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c2529e9882ba04e95830e7--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Tue, 22 Oct 2013 21:14:14 +0300
Raw View
--047d7b33d37447123904e9585e21
Content-Type: text/plain; charset=ISO-8859-1

On 22 October 2013 21:00, Billy O'Neal <billy.oneal@gmail.com> wrote:

> Isn't there potential for confusion where users think ^^ means
> exponentiation? This is already confusing for many users.
>

Everybody, please do take a look at
http://cplusplus.github.io/EWG/ewg-closed.html#37

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--047d7b33d37447123904e9585e21
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 22 October 2013 21:00, Billy O&#39;Neal <span dir=3D"ltr">&lt;<a=
 href=3D"mailto:billy.oneal@gmail.com" target=3D"_blank">billy.oneal@gmail.=
com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Isn&#39;=
t there potential for confusion where users think ^^ means exponentiation? =
This is already confusing for many users.</div>
</blockquote><div><br></div><div>Everybody, please do take a look at<br><a =
href=3D"http://cplusplus.github.io/EWG/ewg-closed.html#37">http://cplusplus=
..github.io/EWG/ewg-closed.html#37</a><br>=A0<br><br></div></div><br></div><=
/div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7b33d37447123904e9585e21--

.


Author: Daryle Walker <darylew@gmail.com>
Date: Thu, 24 Oct 2013 16:57:40 -0700 (PDT)
Raw View
------=_Part_230_1877497.1382659060358
Content-Type: text/plain; charset=ISO-8859-1

On Tuesday, October 22, 2013 2:14:14 PM UTC-4, Ville Voutilainen wrote:

> On 22 October 2013 21:00, Billy O'Neal <billy...@gmail.com <javascript:>>wrote:
>
>> Isn't there potential for confusion where users think ^^ means
>> exponentiation? This is already confusing for many users.
>>
>
> Everybody, please do take a look at
> http://cplusplus.github.io/EWG/ewg-closed.html#37
>

The issues with Boolean conversion can be solved by using "!a != !b". I'm
not saying that "operator ^^" is a good idea, though.

Daryle W.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_230_1877497.1382659060358
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tuesday, October 22, 2013 2:14:14 PM UTC-4, Ville Vouti=
lainen wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div>On 22 October 2013 21:00, Billy O'Neal <span dir=3D"ltr">&lt;<a hr=
ef=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"W49BCAGLQ18J"=
>billy...@gmail.com</a>&gt;</span> wrote:<br><div class=3D"gmail_quote">
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Isn't th=
ere potential for confusion where users think ^^ means exponentiation? This=
 is already confusing for many users.</div>
</blockquote><div><br></div><div>Everybody, please do take a look at<br><a =
href=3D"http://cplusplus.github.io/EWG/ewg-closed.html#37" target=3D"_blank=
">http://cplusplus.github.io/<wbr>EWG/ewg-closed.html#37</a><br></div></div=
></div></div></blockquote><div><br></div><div>The issues with Boolean conve=
rsion can be solved by using "<font face=3D"courier new, monospace">!a !=3D=
 !b</font>". I'm not saying that "<font face=3D"courier new, monospace">ope=
rator ^^</font>" is a good idea, though.</div><div><br></div><div>Daryle W.=
</div><div><br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_230_1877497.1382659060358--

.