loading ...
搜狐圈子 IT数码 IT美眉 浏览帖子

来自圈子:IT美眉 (49 人)

圈子描述:IT业界最好的IT美女记者编辑聚集地
圈子标签:IT 业界 互联网 IT美眉
IT美眉
副圈主:
共0页 | 上一页   1   下一页

VS2005 warning C4996 0/?

包含ACE之后代码还没怎么写就出现了下面类似的29个warning:

warning C4996: “strcat”被声明为否决

上网查找的答案如下英文所述:

  If   you   compile   this   code   with   VS2005   Beta   1   or   CTP,   you   see   a   warnings   for   strcpy   and   sprintf,   which   let   you   know   that   these   functions   have   been   deprecated.   A   fair   questions   why   they   have   been   deprecated.   A   short   answer,   because   these   are   inherently   insecure   functions   that   can   "help"   you   to   create   a   code   that   makes   your   application   vulnerable   to   buffer   overrun   type   of   attacks.  
   
  There   are   two   ways   to   fix   this   problem.   The   first   one,   is   to   change   your   code   to   use   the   new   secure   invariants   of   these   functions,   which   are   strcpy_s   and   sprintf_s.   However   it   may   sometime   to   do   these   for   deprecated   CRT   functions   that   you   use.   So   the   second   way   is   to   use   #define   _CRT_SECURE_NO_DEPRACATE.   This   define   will   make   all   warnings   go   away.   So   if   you   just   what   to   make   your   app   to   build   clean   with   the   new   VS,   this   option   may   works   for   you.   However,   I   would   not   recommend   you   to   stay   with   option   for   a   long   time.   Go   ahead   and   read   about   new   Security   Enhancements   in   the   CRT.   I   will   also   try   to   post   more   information   about   this   cool   feature   implemented   in   VS2005   on   my   blog.   I   know   that   there   is   a   draft   of   a   whitepaper   on   this   topic   has   been   prepared   that   goes   in   detail   of   desing   and   implementaion   of   this   feature.   As   soon   as   I   know   about   this   paper,   I   will   publish   a   link   to   it.

也就是添加欲编译宏:“_CRT_SECURE_NO_DEPRACATE”

我要抱怨了!也不知道这英文怎么抄的?粗心的人就这么多!!
难道写的时候就不能看一眼字吗?
知道
DEPRACATE和
DEPRECATE的区别吗?
金山词霸 http://dict.iciba.com/deprecate/ 中:deprecate:不赞成, 驳斥, 反对
而depracate什么也不是!

长个记性也长个心眼,_CRT_SECURE_NO_DEPRECATE是忽略CRT安全函数警告的宏定义!

另外我的29个warning因此减少到了10个,剩下的都是“rmdir”被声明为否决的、“access”、“unlink”、“mkdir”等这些linux下的命令函数,对于_CRT_SECURE_NO_DEPRECATE不管用,可能不是CRT的,目前依然存留。请求各位指点。

共0页 | 上一页   1   下一页