title: Converting false to pointer type void*?
body: <p>Can someone explain me what is going on here...?</p>
  
  <p>I had this code:</p>
  
  <pre><code>#include &lt;fstream&gt;
  #include &lt;string&gt;
  #include &lt;iostream&gt; 
  int main(){   
      std::ifstream file("test.txt");    
      std::string x;
      while (true) { 
          if (!(file &gt;&gt; x)) return 0;
          std::cout &lt;&lt; x &lt;&lt; "\n";   
      }
  }
  </code></pre>
  
  <p>...compiles fine, does what it is supposed to do, no problem so far. Sometimes I dont like the <code>!</code> so much, because it can be overlooked easily, so I replaced the <code>if</code> with</p>
  
  <pre><code>if ((file &gt;&gt; x)==false) return 0;  
  </code></pre>
  
  <p>..and suddenly my compiler (gcc 4.8.5) complains with a warning:</p>
  
  <pre><code> warning: converting ‘false’ to pointer type ‘void*’ [-Wconversion-null]
       if ((file &gt;&gt; x)==false) return 0;
  </code></pre>
  
  <p>and this is where I am starting to be puzzled. Where is the <code>void*</code> coming from? Doesnt <code>&gt;&gt;</code> return a reference that should be casted to a <code>bool</code>? Why is <code>false</code> converted to <code>void*</code>? Why isnt the same warning triggered when I dont explicitly write <code>false</code>?</p>
  
  <p>Out of curiosity I also tried this:</p>
  
  <pre><code>if ((file&gt;&gt;x)==true) return 0;
  </code></pre>
  
  <p>which causes a storm of errors starting with </p>
  
  <pre><code>error: no match for ‘operator==’ (operand types are ‘std::basic_istream&lt;char&gt;’ and ‘bool’)
   if ((file&gt;&gt;x)==true) return 0;
                ^
  </code></pre>
  
  <p>and now I am completely lost. How is <code>false</code> a differnt <code>bool</code> than <code>true</code>? Different values of course, but I always thought <code>true</code> and <code>false</code> are of same type.</p>