title: Single function interface using struct for in/out parameters
body: <p>I want to create a single function interface with a function that takes an ID and a parameter struct.
  Internally, functions are called and parameters from the struct are passed to the function. the returning values are passed to pointers in the struct.
  What are some pitfalls in this design? Is there anything that is faster than a switch-case statement?</p>
  
  <pre><code>enum Id{ CALL_1, CALL_2};
  struct PARM_1 { int parm1; int parm2; void* data};
  struct PARM_2 { int parm1; int* parm2};
  
  void function(int id, void* parm)
  {
    switch (id)
    {
     case CALL_1:
     {
      PARM_1* p = (struct PARM_1*) parm;
      function_1(p-&gt;parm1, p-&gt;parm2, parm-&gt;data); 
      break;
     }
    case CALL_2:
     {
      PARM_2* p = (struct PARM_2*) parm;
      function_2(p-&gt;parm1, p-&gt;parm2);
      break;
     }
    default:
      break;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>void foo(int parm1, int parm2, void <em>data);
  void barint parm1, int</em> parm2);</p>