strdup or _strdup?

后端 未结 7 2113
我寻月下人不归
我寻月下人不归 2020-12-01 04:05

When I use strdup in Microsoft Visual C++, it warns me:

warning C4996: \'strdup\': The POSIX name for this item is deprecated. Instead, u

7条回答
  •  猫巷女王i
    2020-12-01 04:38

    Don't know about C++.

    The C Standard does not describe any function with the strdup name (though the name is reserved). To be portable, in C, you're better off replacing that with malloc, strcpy, and free.

提交回复
热议问题