title: C++ function call without brackets
body: <p>I came across this while programming and forgetting the brackets after the function call, but I only got a warning, which I overlooked:</p>
  
  <pre><code>main.cpp:7:15: warning: expression result unused [-Wunused-value]
                  if (i == 0) clearDisplay;
                              ^~~~~~~~~~~~
  </code></pre>
  
  <p>The same thing happens when just doing</p>
  
  <pre><code>int i = 0;
  i;
  </code></pre>
  
  <p>Why isn't this a compiler error?</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  void clearDisplay(void);
  
  int main(void){
      for(int i = 0; i &lt; 2; i++){
          if (i == 0) clearDisplay;
      }
  }
  
  void clearDisplay(void){
      std::cout &lt;&lt; "test" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>EDIT:
  As opposed to <a href="https://stackoverflow.com/questions/17073066/g-calling-function-without-parenthesis-not-f-but-f-why-always-return">g++ &quot;Calling&quot; function without parenthesis ( not f() but f; ). Why always returns 1?</a> I don't ask why it is implicitly casted to a number but why the compiler doesn't warn me about that like it does with <code>if(i=0)</code> to <code>if(i==0)</code></p>