Visual Studio Warning C4996

后端 未结 2 875
说谎
说谎 2020-12-03 06:31

I\'m getting the following warning

warning C4996: \'std::_Uninitialized_copy0\': Function call with parameters that may be unsafe - this call relies on the ca

相关标签:
2条回答
  • 2020-12-03 07:03

    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.

    0 讨论(0)
  • 2020-12-03 07:26

    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 讨论(0)
提交回复
热议问题