title: inline assembly in c++ using visual studio 2010?
body: <p>I  tried to compile the following code using visual studio 2010 under 64 bit windows 7.</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  using namespace std;
  
  int strlen2(char str[] )
  {
  int x ;
      _asm
          {   
              MOV ESI,0;
      LA:     MOV DL,BYTE PTR str[ESI];
              CMP DL,0;
              JE EXIT;
              INC ESI;
              JMP LA;
      EXIT:   MOV x,ESI;
  
          };
  
  return x;
  }
  
  int main()
  {
  char X[] ="string2222";
  cout&lt;&lt;strlen2(X);
  system("pause");
  return 0;
  }
  </code></pre>
  
  <p>and I expect that the output will be "10Press any key to continue . . .",<br/>       but unfortunately, the output was
  "3Press any key to continue . . ." for any value of X[].<br/>
  could you please explain where is the error???</p>