<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: 9.1 &#8212; Introduction to operator overloading</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/91-introduction-to-operator-overloading/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/91-introduction-to-operator-overloading/</link>
	<description></description>
	<pubDate>Wed, 20 Aug 2008 09:34:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Learn C++ - &#187; 8.14 &#8212; Anonymous variables and objects</title>
		<link>http://www.learncpp.com/cpp-tutorial/91-introduction-to-operator-overloading/#comment-14400</link>
		<dc:creator>Learn C++ - &#187; 8.14 &#8212; Anonymous variables and objects</dc:creator>
		<pubDate>Mon, 05 May 2008 02:01:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/91-operator-overloading/#comment-14400</guid>
		<description>[...]  9.1 â€” Introduction to operator overloading [...]</description>
		<content:encoded><![CDATA[<p>[...]  9.1 â€” Introduction to operator overloading [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ethicalstar</title>
		<link>http://www.learncpp.com/cpp-tutorial/91-introduction-to-operator-overloading/#comment-11204</link>
		<dc:creator>ethicalstar</dc:creator>
		<pubDate>Tue, 08 Apr 2008 09:37:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/91-operator-overloading/#comment-11204</guid>
		<description>ofcourse! rightly said!!!</description>
		<content:encoded><![CDATA[<p>ofcourse! rightly said!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/91-introduction-to-operator-overloading/#comment-6081</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 15 Jan 2008 20:30:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/91-operator-overloading/#comment-6081</guid>
		<description>Consider the following mathematical equation: 5 * 2 ^ 3

Using standard mathematical precedence rules, exponents are evaluated before multiplication.  Thus, we'd solve this equation as: 5 * (2 ^ 3), which evaluates to 5 * 8 = 40.

Now, let's say we overloaded the XOR operator (^) to make it do exponents instead of bitwise XOR.  According to C++ precedence rules, the multiplication operator takes precedence over the XOR operator.   
As a result, C++ would evaluate our mathematical equation above like this: (5 * 2) ^ 3.  Consequently, it would produce the result 1000 instead of 40.  This would be unintuitive to someone expecting the equation to be evaluated according to normal mathematical precedence rules.  Thus, it would not be a good idea to overload the XOR operator in this way.

Unfortunately, there is no way to change the precedence of operators in C++.</description>
		<content:encoded><![CDATA[<p>Consider the following mathematical equation: 5 * 2 ^ 3</p>
<p>Using standard mathematical precedence rules, exponents are evaluated before multiplication.  Thus, we&#8217;d solve this equation as: 5 * (2 ^ 3), which evaluates to 5 * 8 = 40.</p>
<p>Now, let&#8217;s say we overloaded the XOR operator (^) to make it do exponents instead of bitwise XOR.  According to C++ precedence rules, the multiplication operator takes precedence over the XOR operator.<br />
As a result, C++ would evaluate our mathematical equation above like this: (5 * 2) ^ 3.  Consequently, it would produce the result 1000 instead of 40.  This would be unintuitive to someone expecting the equation to be evaluated according to normal mathematical precedence rules.  Thus, it would not be a good idea to overload the XOR operator in this way.</p>
<p>Unfortunately, there is no way to change the precedence of operators in C++.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Renu</title>
		<link>http://www.learncpp.com/cpp-tutorial/91-introduction-to-operator-overloading/#comment-6079</link>
		<dc:creator>Renu</dc:creator>
		<pubDate>Tue, 15 Jan 2008 19:37:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/91-operator-overloading/#comment-6079</guid>
		<description>I didnt understand this
"all operators keep their current precedence and associativity, regardless of what they're used for. For example, the bitwise XOR operator (^) could be overloaded to do exponents, except it has the wrong precedence and associativity and there is no way to change this "

Could you please elaborate this?
Thanks,
Renu</description>
		<content:encoded><![CDATA[<p>I didnt understand this<br />
&#8220;all operators keep their current precedence and associativity, regardless of what they&#8217;re used for. For example, the bitwise XOR operator (^) could be overloaded to do exponents, except it has the wrong precedence and associativity and there is no way to change this &#8221;</p>
<p>Could you please elaborate this?<br />
Thanks,<br />
Renu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/91-introduction-to-operator-overloading/#comment-6015</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Mon, 14 Jan 2008 16:01:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/91-operator-overloading/#comment-6015</guid>
		<description>The people who write compilers are very smart! :)</description>
		<content:encoded><![CDATA[<p>The people who write compilers are very smart! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhishek</title>
		<link>http://www.learncpp.com/cpp-tutorial/91-introduction-to-operator-overloading/#comment-6006</link>
		<dc:creator>Abhishek</dc:creator>
		<pubDate>Mon, 14 Jan 2008 13:07:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/91-operator-overloading/#comment-6006</guid>
		<description>compilers are very smart!</description>
		<content:encoded><![CDATA[<p>compilers are very smart!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
