title: Inlining this function or not?
body: <p>I'm supposed to implement a function which compares two strings simliar so <code>strcmp</code> but ignoring whitespace characters, so</p>
  
  <pre><code>strcmpignorews("abc   ", " a b c")
  </code></pre>
  
  <p>should give the same result.</p>
  
  <p>Here's my implementation:</p>
  
  <pre><code>namespace {
      void SkipWhitespace(const char *&amp;s) {
          for (; std::isspace(*s, std::locale::classic); ++s);
      }
  }
  
  int strcmpignorews(const char *s1, const char *s2) {
      for (; *s1 != '\0' &amp;&amp; *s2 != '\0'; ++s1, ++s2) {
          SkipWhitespace(s1);
          SkipWhitespace(s2);
  
          if (*s1 != *s2) {
              break;
          }
      }
  
      return (*s1 &lt; *s2) ? -1 : ((*s1 == *s2) ? 0 : 1);
  }
  </code></pre>
  
  <p>Now, the question is, would it make sense to inline the SkipWhitespace function? I think I've read somewhere that <code>inline</code> should not be used for functions which contain loops or switches but I can't remember where and why.</p>