title: The blocks in code coverage with VS2010
body: <p>I run the C++ code to get code coverage results as is in <a href="https://stackoverflow.com/questions/4951089/how-to-use-ms-code-coverage-tool-in-command-line">this post</a>.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int testfunction(int input)
  {
      if (input &gt; 0) {
          return 1;
      }
      else {
          return 0;
      }
  }
  
  int main()
  {
      testfunction(-1);
      testfunction(1);
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/lEJ7i.jpg" alt="enter image description here"></p>
  
  <p>The code coverage result says there are three blocks in the main(), and four blocks in the testfunction(). What does the block mean? How does are there the 3/4 blocks in main/testfunction?</p>
  
  <h2>ADDED</h2>
  
  <p>When I modified the code as follows,</p>
  
  <pre><code>int main()
  {
      testfunction(1);
      testfunction(1);
  }
  </code></pre>
  
  <p>or as follows</p>
  
  <pre><code>int main()
  {
      testfunction(-1);
      testfunction(-1);
  }
  </code></pre>
  
  <p>I have this result.</p>
  
  <p><img src="https://i.stack.imgur.com/QVt8J.jpg" alt="enter image description here"></p>
  
  <p>And it seems that the <code>testfunction()</code> has four blocks.</p>
  
  <ol>
  <li>the function entry</li>
  <li>if block</li>
  <li>else block </li>
  <li>condition </li>
  </ol>
  
  <p>I got hints from <a href="http://msdn.microsoft.com/en-us/vstudio/aa718857.aspx" rel="nofollow noreferrer">this post</a>.</p>