title: C++ this pointer, hidden argument in function calls
body: <p>I have a stack class with members and a function called push.</p>
  
  <pre><code>class STACK
  {
      int data;
      public:
      void push(int x)
      {
          data=x;
      }
  }
  </code></pre>
  
  <p>What does C++ do to convert this statement: </p>
  
  <pre><code>s1.push(3);
  </code></pre>
  
  <p>to </p>
  
  <pre><code>s1.push(this,3);
  </code></pre>
  
  <p>Basically my question is what happens under the hood to generate the <code>this</code> pointer and pass it as a hidden argument?</p>
  
  <p>I am actually coding in C. My objective is to have a program which is as close to OOP as possible. For this i have function pointers as members of the structure. Therefore, I want to know if it is possible to somehow have track of which structure called the function (like a "this" pointer ). I don't want to do something like: s1.push(&amp;s1,3); because it beats my purpose.</p>
  
  <p><strong>IS IT possible to convert s1.push(3); to s1.push(&amp;1,3); via MACRO substitution</strong></p>