C4996 (function unsafe) warning for strcpy but not for memcpy

前端 未结 7 2264
青春惊慌失措
青春惊慌失措 2020-11-27 08:03

I am writing code in VS2010 and I happen to see after compilation compiler gives me C4996 warning (\"This function or variable may be unsafe\") for strcpy and sprintf calls.

7条回答
  •  情深已故
    2020-11-27 08:45

    The warning meens that the function is deprecated and will not be available in future versions: http://msdn.microsoft.com/en-US/en-en/library/ttcz0bys.aspx You can't add other functions to the deprecate list of Microsoft.

    The reason for the deprecation are "unsafe", but that's different from your assumption "C4496 shows you all unsafe functions".

提交回复
热议问题