<?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/" > <channel><title>Comments on: Mayday Programming Brain Teaser</title> <atom:link href="http://adammonsen.com/post/337/feed" rel="self" type="application/rss+xml" /><link>http://adammonsen.com/post/337?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tiny-brain-teaser</link> <description></description> <lastBuildDate>Sat, 31 Mar 2012 19:34:03 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: Jason</title><link>http://adammonsen.com/post/337/comment-page-1#comment-11788</link> <dc:creator>Jason</dc:creator> <pubDate>Fri, 02 May 2008 03:17:12 +0000</pubDate> <guid isPermaLink="false">http://adammonsen.com/post/337#comment-11788</guid> <description>I would guess that the result in C was dependent on how closely the compiler follows operator precedence/binding.The postfix increment operator &quot;++&quot; is at the top of the precedence chart where direct assignment &quot;=&quot; is almost at the bottom.Wouldn&#039;t CPP turn it into:k = (k++)and not:k = k; k++;??Then I found this:&quot;Postfix increment/decrement have high precedence, but the actual increment or decrement of the operand is delayed (to be accomplished sometime before the statement completes execution). So in the statement  y = x * z++;  the current value of z is used to evaluate the expression (i.e.,  z++  evaluates to z) and z only incremented after all else is done.&quot;I couldn&#039;t locate a copy of the ANSI C standard in the 5 min. I spent looking...YMMV. Darn!</description> <content:encoded><![CDATA[<p>I would guess that the result in C was dependent on how closely the compiler follows operator precedence/binding.</p><p>The postfix increment operator &#8220;++&#8221; is at the top of the precedence chart where direct assignment &#8220;=&#8221; is almost at the bottom.</p><p>Wouldn&#8217;t CPP turn it into:</p><p>k = (k++)</p><p>and not:</p><p>k = k;<br /> k++;</p><p>??</p><p>Then I found this:</p><p>&#8220;Postfix increment/decrement have high precedence, but the actual increment or decrement of the operand is delayed (to be accomplished sometime before the statement completes execution). So in the statement  y = x * z++;  the current value of z is used to evaluate the expression (i.e.,  z++  evaluates to z) and z only incremented after all else is done.&#8221;</p><p>I couldn&#8217;t locate a copy of the ANSI C standard in the 5 min. I spent looking&#8230;</p><p>YMMV. Darn!</p> ]]></content:encoded> </item> <item><title>By: Steven</title><link>http://adammonsen.com/post/337/comment-page-1#comment-11787</link> <dc:creator>Steven</dc:creator> <pubDate>Fri, 02 May 2008 00:30:48 +0000</pubDate> <guid isPermaLink="false">http://adammonsen.com/post/337#comment-11787</guid> <description>The system/application admin says:Because some parsers see ++ as a sequential step to perform after the items before it.&quot;the variable k is equal to the variable k.  now increment k by one.&quot;In some languages this can be solved by writing the code like this:k = ++k;Which translates to &quot;the variable k is equal to the incremented value of k.&quot;Or I could be completely wrong... :-)</description> <content:encoded><![CDATA[<p>The system/application admin says:</p><p>Because some parsers see ++ as a sequential step to perform after the items before it.</p><p>&#8220;the variable k is equal to the variable k.  now increment k by one.&#8221;</p><p>In some languages this can be solved by writing the code like this:</p><p>k = ++k;</p><p>Which translates to &#8220;the variable k is equal to the incremented value of k.&#8221;</p><p>Or I could be completely wrong&#8230; :-)</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: adammonsen.com @ 2012-05-21 15:39:23 -->
