When I use strdup
in Microsoft Visual C++, it warns me:
warning C4996: \'strdup\': The POSIX name for this item is deprecated. Instead, u
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
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.