Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Warning C4996

Tags:

c++

warnings

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?

like image 643
Anthony Avatar asked Jul 23 '10 11:07

Anthony


People also ask

How do I enable warnings in Visual Studio?

If you want to turn it on (or off) in the project setting, you have to go to: Configuration Properties -> C/C++ -> Command Line and then under Additional Options you can enter: /w3#### to set your warning to level 3, and thus enable it; or you can enter /wd#### to disable a warning.

How do you ignore warnings in C++?

To disable a set of warnings for a given piece of code, you have to start with a “push” pre-processor instruction, then with a disabling instruction for each of the warning you want to suppress, and finish with a “pop” pre-processor instruction.


1 Answers

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.

like image 96
ssegvic Avatar answered Oct 14 '22 14:10

ssegvic