title: When to use include guards?
body: <p>I know that the use of include guards in header files is to prevent something from being defined twice. Using this code sample though, was completely fine:</p>
  
  <p>foo.c</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include "bar.h"
  
  int main() {
      printf("%d", strlen("Test String"));
      somefunc("Some test string...");
      return 0;
  }
  </code></pre>
  
  <p>bar.h</p>
  
  <pre><code>#ifndef BAR_H_INCLUDED
  #define BAR_H_INCLUDED
  void somefunc(char str[]);
  #endif
  </code></pre>
  
  <p>bar.c</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include "bar.h"
  
  void somefunc(char str[]) {
      printf("Some string length function: %d", strlen(str));
  }
  </code></pre>
  
  <p>The above snippets are compiled with <code>gcc -Wall foo.c bar.c -o foo</code> and there is no error. However, both <code>&lt;stdio.h&gt;</code> and <code>&lt;string.h&gt;</code> were included without an include guard. There is still no error when I strip bar.h down to the single statement <code>void somefunc(char str[]);</code>. Why is there no error?</p>