<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>C on His Deeds Are Dust</title>
    <link>https://hisdeedsaredust.com/tags/c/</link>
    <description>Recent content in C on His Deeds Are Dust</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-gb</language>
    <copyright>Paul Flo Williams</copyright>
    <lastBuildDate>Wed, 16 Jun 2010 13:43:04 +0100</lastBuildDate><atom:link href="https://hisdeedsaredust.com/tags/c/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>The undervalued bool</title>
      <link>https://hisdeedsaredust.com/posts/2010/the-undervalued-bool/</link>
      <pubDate>Wed, 16 Jun 2010 13:43:04 +0100</pubDate>
      
      <guid>https://hisdeedsaredust.com/posts/2010/the-undervalued-bool/</guid>
      <description>&lt;p&gt;A colleague of mine wanted to reduce the repetition in this fragment of C++:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;funcA(false);
funcB(false);
funcC(false);
funcD(false);
funcA(true);
funcB(true);
funcC(true);
funcD(true);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and, in a burst of sheer genius, came up with this solution:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;for (bool status = false;
          status &amp;lt;= true;
          ++status) {
  funcA(status);
  funcB(status);
  funcC(status);
  funcD(status);
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;He then scratched his head as the program looped for eternity.&lt;/p&gt;
&lt;p&gt;Who could have predicted that a common-or-garden &lt;code&gt;bool&lt;/code&gt; could have so many values? Let me count them. The possible values of &lt;code&gt;bool&lt;/code&gt;
are &lt;code&gt;false&lt;/code&gt;, &lt;code markdown=&#34;span&#34;&gt;&lt;a href=&#34;http://www.snopes.com&#34;&gt;snopes&lt;/a&gt;&lt;/code&gt;, &lt;code&gt;statistically_significant&lt;/code&gt;, &lt;code&gt;almost_true&lt;/code&gt;, &lt;code&gt;true&lt;/code&gt;,
&lt;code&gt;very_true&lt;/code&gt; and &lt;code&gt;tautology&lt;/code&gt;. &lt;code&gt;++tautology&lt;/code&gt; gives you &lt;code&gt;tautology&lt;/code&gt; right back, as &lt;a href=&#34;http://en.wikipedia.org/wiki/Nigel_Molesworth&#34;&gt;any fule
kno&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
