title: how write this code in c++
body: <p>i have following code</p>
  
  <pre><code>uint32 joaat_hash(uchar *key, size_t len)
    {
      uint32 hash = 0;
      size_t i;
  
      for (i = 0; i &lt; len; i++)
      {
          hash += key[i];
          hash += (hash &lt;&lt; 10);
          hash ^= (hash &gt;&gt; 6);
      }
      hash += (hash &lt;&lt; 3);
      hash ^= (hash &gt;&gt; 11);
      hash += (hash &lt;&lt; 15);
      return hash;
  }
  </code></pre>
  
  <p>what will be it's equivalent code in c++? i means data types</p>
  
  <pre><code>1&gt;------ Build started: Project: hash_functions, Configuration: Debug Win32 ------
  1&gt;  hash_function.cpp
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C2146: syntax error : missing ';' before identifier 'joaat_hash'
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C2065: 'uchar' : undeclared identifier
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C2065: 'key' : undeclared identifier
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C2275: 'size_t' : illegal use of this type as an expression
  1&gt;          c:\users\david\documents\visual studio 2010\projects\hash_functions\predefined c++ types (compiler internal)(19) : see declaration of 'size_t'
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C2146: syntax error : missing ')' before identifier 'len'
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C2078: too many initializers
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C2275: 'size_t' : illegal use of this type as an expression
  1&gt;          c:\users\david\documents\visual studio 2010\projects\hash_functions\predefined c++ types (compiler internal)(19) : see declaration of 'size_t'
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(3): error C2059: syntax error : ')'
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(4): error C2143: syntax error : missing ';' before '{'
  1&gt;c:\users\david\documents\visual studio 2010\projects\hash_functions\hash_function.cpp(4): error C2447: '{' : missing function header (old-style formal list?)
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>