title: C : function pointer and typedef problem
body: <p>I have a C function that takes a function pointer as argument, it's a destructor that I'll call at the end of my program. Here is the prototype of my function :</p>
  
  <pre><code>int store_dest(void (*routine)(void *));
  </code></pre>
  
  <p>I want to store this function pointer into a structure with some other infos. In order to have a nice struct, I want to have a typedef to this function pointer. Here is my typedef :</p>
  
  <pre><code>typedef void (*my_destructor)(void *);
  </code></pre>
  
  <p>And here is my structure :</p>
  
  <pre><code>typedef struct my_struct{
    my_destructor dest;
    other_info ...
  } my_struct;
  </code></pre>
  
  <p>During the initialization step, I want to set the "dest" field to a function of mine, here is the prototype of this function :</p>
  
  <pre><code>void* my_dummy_dest(void* foo);
  </code></pre>
  
  <p>The problem (in fact it's just a warning but I'd like to suppress it) occurs when I try to set the "dest" field of my structure to "my_dummy_dest" :</p>
  
  <pre><code>my_struct.dest = &amp;my_dummy_dest;
  </code></pre>
  
  <p>I get a "warning: assignment from incompatible pointer type"</p>
  
  <p>Same when I just compare them :</p>
  
  <pre><code>if (my_struct.dest == &amp;my_dummy_dest)
  </code></pre>
  
  <p>I get a "warning: comparison of distinct pointer types lacks a cast"</p>
  
  <p>But I get no warning when I set the "dest" field with another routine. I don't get why I have those warnings.</p>