title: Getting The Size of a C++ Function
body: <p>I was reading <a href="https://stackoverflow.com/questions/4579574/how-can-i-get-the-size-of-a-c-function">this</a> question because I'm trying to find the size of a function in a C++ program, It is hinted at that there may be a way that is platform specific. My targeted platform is windows</p>
  
  <p>The method I currently have in my head is the following:<br>
  1. Obtain a pointer to the function<br>
  2. Increment the Pointer (&amp; counter) until I reach the machine code value for <code>ret</code><br>
  3. The counter will be the size of the function?  </p>
  
  <p><strong>Edit1:</strong> To clarify what I mean by 'size' I mean the number of bytes (machine code) that make up the function.<br>
  <strong>Edit2:</strong> There have been a few comments asking why or what do I plan to do with this. The honest answer is I have no intention, and I can't really see the benefits of knowing a functions length pre-compile time. (although I'm sure there are some)</p>
  
  <p>This seems like a valid method to me, will this work?</p>