开发者

Visual Studio Warning C4996

I'm getting the following warning

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

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?


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

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).

Check also this and that discussions.


This error is generated because the code the compiler produces is not thread-safe. This means that if you are using multi-threaded coding, some of your stream I/O can (and probably will) get lost because the internal I/O buffers are shared. The suggested substitute functions will "eliminate" this problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜