码迷,mamicode.com
首页 > 编程语言 > 详细

C++开发--在Visual Studio2013中使用boost::split()编译过程中出现error C4996

时间:2015-01-25 17:58:11      阅读:448      评论:0      收藏:0      [点我收藏+]

标签:

Visual Studio is being overly cautious.  In debug mode, visual studio uses something called "Checked Iterators".  Pointers are also iterators, but the checking mechanism doesn‘t work with them.  So when a standard library algorithm is called with pointers, which is something that boost::split does, it issues this warning.

You‘ll get the same warning with this obviously safe code:

1 int main()
2 {
3     int x[10] = {};
4     int y[10] = {};
5     int *a = x, *b = y;
6     std::copy(a, a+10, b);
7 }

Disable the warning.  It‘s for beginners.  It‘s on by default for the safety of beginners, because if it was off by default, they wouldn‘t know how to turn it on.

Add -D_SCL_SECURE_NO_WARNINGS to the command line.  In the IDE, you can go to "Project -> Properties -> C/C++ -> Command Line" and add it in the additional options field.

 

ref:http://stackoverflow.com/questions/14141476/warning-with-boostsplit-when-compiling

C++开发--在Visual Studio2013中使用boost::split()编译过程中出现error C4996

标签:

原文地址:http://www.cnblogs.com/feiling/p/4248550.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!