title: Is it possible to modify function call with minimum code change?
body: <p>I guess what I want to do is something like this (expressed like a marco).</p>
  
  <pre><code>    #define x-&gt;send(str)  x-&gt;send(my(x, str))
  </code></pre>
  
  <p>inside function "my"</p>
  
  <pre><code>    char *my(X x, char *d)
      {
          strcat(d, x-&gt;name);  // assuming no memory problem
      }
  </code></pre>
  
  <p>Basically, need to attach more information about x. Of course, there are other ways around. But I want to keep minimum changes to the code, and there is no way to modify the X class. Thank you!</p>
  
  <p>Sample code listed below.</p>
  
  <pre><code>    #include &lt;stdio.h&gt;
      #include &lt;string.h&gt;
  
      #define x-&gt;send(y)    (x-&gt;send(my(x,y)))
  
      class H
      {
      public:
  
        char name[16];
  
        void send(char *str)
        {
          printf("%s", str);
        }
  
        H()
        {
          strcpy(name, "adam");
        }
      };
  
      char *my(H x, char *y)
      {
        strcat (y, "from ");
        return strcat(y, x-&gt;name);
      }
  
      int main()
      {
        H *h = new H;
  
        char str[32];
        strcpy(str, "hello ");
  
        h-&gt;send(str);
  
        return 0;
      }
  </code></pre>