<?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: 7.8 &#8212; Function Pointers</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/78-function-pointers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/</link>
	<description></description>
	<pubDate>Fri, 29 Aug 2008 19:05:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-21669</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Thu, 24 Jul 2008 01:33:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-21669</guid>
		<description>Oops, how did I miss Stuart's original comments?  In any case, I think it should be fixed now.

Thanks for catching this.</description>
		<content:encoded><![CDATA[<p>Oops, how did I miss Stuart&#8217;s original comments?  In any case, I think it should be fixed now.</p>
<p>Thanks for catching this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-21590</link>
		<dc:creator>Sean</dc:creator>
		<pubDate>Wed, 23 Jul 2008 15:19:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-21590</guid>
		<description>I agree with Simon: the comments should be exchanged.</description>
		<content:encoded><![CDATA[<p>I agree with Simon: the comments should be exchanged.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-20892</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Mon, 14 Jul 2008 08:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-20892</guid>
		<description>bool EvensFirst(int nX, int nY)

Alex your comments are incorrect in this function as pointed out by Stuart.

You can either change the if statements to match the comments or change the comments to match the statements.

You need to change the 1st comment with the second, and vice versa .
Stuart's changes also correct the anomalies.

Regards
Simon</description>
		<content:encoded><![CDATA[<p>bool EvensFirst(int nX, int nY)</p>
<p>Alex your comments are incorrect in this function as pointed out by Stuart.</p>
<p>You can either change the if statements to match the comments or change the comments to match the statements.</p>
<p>You need to change the 1st comment with the second, and vice versa .<br />
Stuart&#8217;s changes also correct the anomalies.</p>
<p>Regards<br />
Simon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-17880</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Fri, 30 May 2008 17:41:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-17880</guid>
		<description>I get it now, after rewriting the EvensFirst function to this:
&lt;pre&gt;bool EvensFirst(int nX, int nY)
{
	// if nX is even and nY is not, nX goes first
	if ((nX % 2 == 0) &#38;&#38; !(nY % 2) == 0)
		return true;

	// if nX is not even and nY is, nY goes first
	if (!(nX % 2 == 0) &#38;&#38; (nY % 2 == 0))
		return false;

	// otherwise sort in Ascending order
	return Ascending(nX, nY);
}&lt;/pre&gt;
I got mixed up and didn't realize that nX % 2 actually means that nX is NOT divisible by 2 and !nX % 2 means that it IS divisible by 2.</description>
		<content:encoded><![CDATA[<p>I get it now, after rewriting the EvensFirst function to this:</p>
<pre>bool EvensFirst(int nX, int nY)
{
	// if nX is even and nY is not, nX goes first
	if ((nX % 2 == 0) &amp;&amp; !(nY % 2) == 0)
		return true;

	// if nX is not even and nY is, nY goes first
	if (!(nX % 2 == 0) &amp;&amp; (nY % 2 == 0))
		return false;

	// otherwise sort in Ascending order
	return Ascending(nX, nY);
}</pre>
<p>I got mixed up and didn&#8217;t realize that nX % 2 actually means that nX is NOT divisible by 2 and !nX % 2 means that it IS divisible by 2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-17812</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Thu, 29 May 2008 15:57:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-17812</guid>
		<description>&lt;pre&gt;bool EvensFirst(int nX, int nY)   
{   
        // if nX is even and nY is not, nX goes first   
    if ((nX % 2) &#38;&#38; !(nY % 2))   
        return false;   
  
        // if nX is not even and nY is, nY goes first   
    if (!(nX % 2) &#38;&#38; (nY % 2))   
        return true;   
  
        // otherwise sort in Ascending order   
    return Ascending(nX, nY);   
}&lt;/pre&gt;
How is bool working here? How is the return false and return true working to return the integers in different orders?</description>
		<content:encoded><![CDATA[<pre>bool EvensFirst(int nX, int nY)
{
        // if nX is even and nY is not, nX goes first
    if ((nX % 2) &amp;&amp; !(nY % 2))
        return false;   

        // if nX is not even and nY is, nY goes first
    if (!(nX % 2) &amp;&amp; (nY % 2))
        return true;   

        // otherwise sort in Ascending order
    return Ascending(nX, nY);
}</pre>
<p>How is bool working here? How is the return false and return true working to return the integers in different orders?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 7.7 &#8212; Default parameters</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-13493</link>
		<dc:creator>Learn C++ - &#187; 7.7 &#8212; Default parameters</dc:creator>
		<pubDate>Tue, 29 Apr 2008 05:04:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-13493</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 7.6 &#8212; Function overloading &#124; Home &#124; 7.8 &#8212; Function Pointers &#187;     Monday, August 6th, 2007 at 4:38 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 7.6 &#8212; Function overloading | Home | 7.8 &#8212; Function Pointers &raquo;     Monday, August 6th, 2007 at 4:38 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shyan</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-10236</link>
		<dc:creator>shyan</dc:creator>
		<pubDate>Mon, 24 Mar 2008 06:34:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-10236</guid>
		<description>typedef of function pointer looks complex.
no typedef variable. how it assumed that pfcnVlidate is typedef... confuse


shyam</description>
		<content:encoded><![CDATA[<p>typedef of function pointer looks complex.<br />
no typedef variable. how it assumed that pfcnVlidate is typedef&#8230; confuse</p>
<p>shyam</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-6014</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Mon, 14 Jan 2008 15:56:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-6014</guid>
		<description>This is one of the really ugly parts of C++.  Basically, the type is a pointer to a function returning a bool and taking 2 int parameters, and the name of the typedef is pfcnValidate.

I suspect they did the syntax this way to mimic the way actual function declarations look, but I agree that it doesn't map to the typedef syntax in a very intuitive manner.  It's one of those things I have to look up how to do every time I need to do it... but that's still better than not using typedefs at all.</description>
		<content:encoded><![CDATA[<p>This is one of the really ugly parts of C++.  Basically, the type is a pointer to a function returning a bool and taking 2 int parameters, and the name of the typedef is pfcnValidate.</p>
<p>I suspect they did the syntax this way to mimic the way actual function declarations look, but I agree that it doesn&#8217;t map to the typedef syntax in a very intuitive manner.  It&#8217;s one of those things I have to look up how to do every time I need to do it&#8230; but that&#8217;s still better than not using typedefs at all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Renu</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-5988</link>
		<dc:creator>Renu</dc:creator>
		<pubDate>Mon, 14 Jan 2008 04:29:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-5988</guid>
		<description>Syntax of typedef is:
typedef type alias name;

How does that map to:
typedef bool (*pfcnValidate)(int, int);  

This seems complex.

Renu</description>
		<content:encoded><![CDATA[<p>Syntax of typedef is:<br />
typedef type alias name;</p>
<p>How does that map to:<br />
typedef bool (*pfcnValidate)(int, int);  </p>
<p>This seems complex.</p>
<p>Renu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ainsley</title>
		<link>http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-463</link>
		<dc:creator>Ainsley</dc:creator>
		<pubDate>Sun, 19 Aug 2007 01:12:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/78-function-pointers/#comment-463</guid>
		<description>hi i enjoyed the read</description>
		<content:encoded><![CDATA[<p>hi i enjoyed the read</p>
]]></content:encoded>
	</item>
</channel>
</rss>
