Visual Studio 警告 C4996

2024-06-20

我收到以下警告

warning C4996: 'std::_Uninitialized_copy0': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' c:\program files\microsoft visual studio 10.0\vc\include\memory 348

我似乎找不到任何有助于对抗此警告的信息。通过查看输出,该警告似乎与 Boost.Signals2 和 auto_buffer 有关。

忽略它是否安全,或者我可以以某种方式将其删除吗?


首先,我想说我非常喜欢编译器警告。我使用 -Wall -Wextra 调用 gcc。

然而,MSVC 警告 C4996 主要在完全有效的代码上触发。警告文本中提出的更改通常会严重损害代码的可移植性,而不会实质性地提高代码质量。因此,我经常在我的 MSVC 项目中抑制此警告(项目属性->C++->高级->禁用特定警告)。

还检查this https://stackoverflow.com/questions/14386/fopen-deprecated-warning and that http://forums.thedailywtf.com/forums/p/8208/154437.aspx讨论。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Visual Studio 警告 C4996 的相关文章

随机推荐