Which is correct?
strdup
is a perfectly correct POSIX function. Nevertheless, it doesn’t belong to the standard, and the ANSI C standard reserves some (broad) classes of function names for further use. Among these, there are
- Function names that begin with str and a lowercase letter
therefore, the MS guys decided to replace strdup
with _strdup
.
I’d just continue using strdup
. It’s unlikely the C committee will define strdup
to something else than POSIX. Either #define strdup _strdup
or silence the warning.
BTW I hope you see this applies to your functions with names like string_list
etc., too.