title: strdup() function
body: <p>I recently became aware that the <code>strdup()</code> function I've enjoyed using so much on OS X is not part of ANSI C, but part of POSIX. I don't want to rewrite all my code, so I think I'm just going to write my own <code>strdup()</code> function. It's not that hard, really, it's just a <code>malloc()</code> and a <code>strcpy()</code>. Anyway, I have the function, but what am I doing if I write this function and link it to my code, and it already exists in the libc? Will my linker or compiler allow me to basically define my own version of the function, or do I have to give it another name? It would be terribly convenient if there was a way to reuse the same name, so that if <code>strcpy()</code> exists in the user's libc they could use that, but if it didn't exist in their libc they could use my version instead, with as little code change as possible.</p>
  
  <p>The short version:</p>
  
  <p>a) What happens when I write my own function with the same name as a built-in function?</p>
  
  <p>b) What can I do to avoid bad things happening to me on platforms that don't have <code>strdup()</code> without rewriting all my code to not use <code>strdup()</code>, which is just a bit tedious?</p>