Visual Studio警告C4996 [英] Visual Studio Warning C4996

查看:283
本文介绍了Visual Studio警告C4996的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下警告

警告C4996:'std :: _ Uninitialized_copy0':使用可能不安全的参数调用函数 - 此调用依赖于调用者检查传递的值是否正确。要禁用此警告,请使用-D_SCL_SECURE_NO_WARNINGS。请参阅关于如何使用Visual C ++的Checked Iteratorsc:\program files\microsoft visual studio 10.0 \vc\include\ memory 348

我似乎找不到任何有助于打击这个警告的信息。通过查看输出,似乎这个警告与Boost.Signals2和auto_buffer有关。

I can't seem to find any information that would help to combat this warning. By looking at the output it seems this warning has something to do with Boost.Signals2 and auto_buffer.

这是安全地忽略还是可以以某种方式删除? >

Is this safe to ignore or can I remove it somehow?

推荐答案

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

First, I would like to say that I am quite fond of compiler warnings. I invoke gcc with -Wall -Wextra.

但是,MSVC警告C4996主要是在完全有效的代码上触发的。在警告文本中提出的更改通常严重损害代码的可移植性,而它们从未大幅提高代码质量。因此我经常在我的MSVC项目(项目属性 - > C ++ - >高级 - >禁用特定警告)中禁止此警告。

However, the MSVC warning C4996 mostly fires on completely valid code. The changes proposed in the warning text often seriously compromise the code portability, while they never substantially improve the code quality. Thus I regularly suppress this warning in my MSVC projects (Project properties->C++->Advanced->Disable specific warnings).

请检查 讨论。

这篇关于Visual Studio警告C4996的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆