<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: The Ackermann Function in Java: Why Computers are Stupid</title>
	<atom:link href="http://bytebaker.com/2007/02/10/the-ackermann-function-in-java-why-computers-are-stupid/feed/" rel="self" type="application/rss+xml" />
	<link>http://bytebaker.com/2007/02/10/the-ackermann-function-in-java-why-computers-are-stupid/</link>
	<description>Computer Science isn&#039;t a science and it&#039;s not about computers</description>
	<lastBuildDate>Thu, 11 Mar 2010 14:59:26 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: basu715</title>
		<link>http://bytebaker.com/2007/02/10/the-ackermann-function-in-java-why-computers-are-stupid/#comment-85</link>
		<dc:creator>basu715</dc:creator>
		<pubDate>Fri, 02 Mar 2007 13:08:43 +0000</pubDate>
		<guid isPermaLink="false">http://xcomputers.wordpress.com/2007/02/10/the-ackermann-function-in-java-why-computers-are-stupid/#comment-85</guid>
		<description>I see, thanks. This is definitely one of those &quot;now why didn&#039;t I think of that&quot; moments.</description>
		<content:encoded><![CDATA[<p>I see, thanks. This is definitely one of those &#8220;now why didn&#8217;t I think of that&#8221; moments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nugae</title>
		<link>http://bytebaker.com/2007/02/10/the-ackermann-function-in-java-why-computers-are-stupid/#comment-86</link>
		<dc:creator>nugae</dc:creator>
		<pubDate>Fri, 02 Mar 2007 11:48:23 +0000</pubDate>
		<guid isPermaLink="false">http://xcomputers.wordpress.com/2007/02/10/the-ackermann-function-in-java-why-computers-are-stupid/#comment-86</guid>
		<description>You have declared the &#039;ackerman&#039; function with two parameters, &#039;ack1&#039; and &#039;ack2&#039;, each of which is an &#039;int&#039; - in other words, an integer that can be positive or negative (or zero).
You have promised that you will only call the function when ack1&gt;=0 and ack2&gt;=0, but this is simply a decision that you have happened to take and you might change your mind at any moment. What should the function do if you break your promise? The compiler can&#039;t guess: it needs to know, and it&#039;s complaining because you haven&#039;t told it.
So all your reasoning about &quot;there was only one possible case if the first two conditions were not satisfied&quot; is simply wrong. ack1=-1 is a possible case, because &#039;int&#039; values can be negative as well as positive.
If you told the compiler that ack1&gt;=0 and ack2&gt;=0 then it would know that you had exhausted the possibilities by the end of the last of your &#039;if&#039; statements. In C you can do this by declaring ack1 and ack2 to be an &#039;unsigned&#039; type. I can&#039;t remember whether Java has unsigned types but I don&#039;t think it does.
Given that the compiler can&#039;t detect this for you, the thing to do, after you&#039;ve had &#039;return&#039; statements for all the valid arguments, is to add a statement that throws an IllegalArgumentException if the arguments aren&#039;t valid. I&#039;m not sure whether you&#039;ll then have to have a dummy &#039;return 0&#039; after that or not.</description>
		<content:encoded><![CDATA[<p>You have declared the &#8216;ackerman&#8217; function with two parameters, &#8216;ack1&#8242; and &#8216;ack2&#8242;, each of which is an &#8216;int&#8217; &#8211; in other words, an integer that can be positive or negative (or zero).<br />
You have promised that you will only call the function when ack1&gt;=0 and ack2&gt;=0, but this is simply a decision that you have happened to take and you might change your mind at any moment. What should the function do if you break your promise? The compiler can&#8217;t guess: it needs to know, and it&#8217;s complaining because you haven&#8217;t told it.<br />
So all your reasoning about &#8220;there was only one possible case if the first two conditions were not satisfied&#8221; is simply wrong. ack1=-1 is a possible case, because &#8216;int&#8217; values can be negative as well as positive.<br />
If you told the compiler that ack1&gt;=0 and ack2&gt;=0 then it would know that you had exhausted the possibilities by the end of the last of your &#8216;if&#8217; statements. In C you can do this by declaring ack1 and ack2 to be an &#8216;unsigned&#8217; type. I can&#8217;t remember whether Java has unsigned types but I don&#8217;t think it does.<br />
Given that the compiler can&#8217;t detect this for you, the thing to do, after you&#8217;ve had &#8216;return&#8217; statements for all the valid arguments, is to add a statement that throws an IllegalArgumentException if the arguments aren&#8217;t valid. I&#8217;m not sure whether you&#8217;ll then have to have a dummy &#8216;return 0&#8242; after that or not.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
